• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LayoutParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.widget.AbsoluteLayout.LayoutParams的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LayoutParams类属于android.widget.AbsoluteLayout包,在下文中一共展示了LayoutParams类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setLayoutParams

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
@Override
public void setLayoutParams(ViewGroup.LayoutParams l) {
    layoutParams = l;

    int width;
    int height;

    if (l instanceof AbsoluteLayout.LayoutParams) {
        CGSize size = xmlvmGetTextSize();
        width = l.width == LayoutParams.WRAP_CONTENT ? (int) size.width + 2 * INSETS_X
                : l.width;
        height = l.height == LayoutParams.WRAP_CONTENT ? (int) size.height + 2 * INSETS_Y
                : l.height;

        xmlvmGetViewHandler().setFrame(
                new CGRect(((AbsoluteLayout.LayoutParams) l).x,
                        ((AbsoluteLayout.LayoutParams) l).y, width, height));
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:TextView.java


示例2: setLayoutParams

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
@Override
public void setLayoutParams(ViewGroup.LayoutParams l) {
    layoutParams = l;
    int width = l.width;
    int height = l.height;
    UIImage img = ((UIImageView) xmlvmGetViewHandler().getContentView()).getImage();

    if (width == LayoutParams.WRAP_CONTENT) {
        width = img != null ? (int) img.getSize().width : 0;
    }
    if (height == LayoutParams.WRAP_CONTENT) {
        height = img != null ? (int) img.getSize().height : 0;
    }

    int x = l instanceof AbsoluteLayout.LayoutParams ? ((AbsoluteLayout.LayoutParams) l).x : 0;
    int y = l instanceof AbsoluteLayout.LayoutParams ? ((AbsoluteLayout.LayoutParams) l).y : 0;

    xmlvmGetViewHandler().getMetricsView().setFrame(new CGRect(x, y, width, height));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:ImageView.java


示例3: Zoom

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
void Zoom() {
  int size = m_RocrailService.Prefs.Size;
  Iterator<ZLevel> itZ = zlevelList.iterator();
  while( itZ.hasNext() ) {
    ZLevel zlevel = itZ.next();
    Iterator<Item> it = zlevel.itemList.iterator();
    int xOffset = 0;
    int yOffset = 0;
    if( ModPlan ) {
      xOffset = zlevel.X;
      yOffset = zlevel.Y;
    }
    while( it.hasNext() ) {
      Item item = it.next();
      int x = ModPlan?item.Mod_X:item.X;
      int y = ModPlan?item.Mod_Y:item.Y;
      LayoutParams lp = new LayoutParams(item.cX*size, item.cY*size, (x+xOffset)*size, (y+yOffset)*size);
      item.imageView.size = size;
      levelView.updateViewLayout(item.imageView, lp);
    }
  }
}
 
开发者ID:prashant31191,项目名称:andRoc,代码行数:23,代码来源:ActLevel.java


示例4: onCreate

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {

	super.onCreate(savedInstanceState);
	// 全屏显示
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
			WindowManager.LayoutParams.FLAG_FULLSCREEN);
	// 加载layout
	setContentView(R.layout.activity_ruan_activity10);
	// 按照queue的顺序显示图片
	findImageView(queue);
	//按钮
	Button button01 = (Button) findViewById(R.id.button01);
	Button button02 = (Button) findViewById(R.id.button02);
	button01.setOnClickListener(button01Listener);
	button02.setOnClickListener(button02Listener);
}
 
开发者ID:XinboAndroid,项目名称:xinbo_android,代码行数:19,代码来源:RuanActivity10.java


示例5: ProgressWebView

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
public ProgressWebView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    this.progressbar = new ProgressBar(context, null, 16842872);
    this.progressbar.setLayoutParams(new LayoutParams(-1, Util.dip2px(context, 3.0f), 0, 0));
    this.progressbar.setProgressDrawable(context.getResources().getDrawable(R.drawable.webview_loading_progress_style));
    addView(this.progressbar);
    setWebChromeClient(new WebChromeClient(this));
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:ProgressWebView.java


示例6: onScrollChanged

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
    LayoutParams lp = (LayoutParams) this.progressbar.getLayoutParams();
    lp.x = l;
    lp.y = t;
    this.progressbar.setLayoutParams(lp);
    super.onScrollChanged(l, t, oldl, oldt);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:ProgressWebView.java


示例7: onTouch

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
@Override
public boolean onTouch(View p_v, MotionEvent p_event)
{
	switch (p_event.getAction())
		{
			case MotionEvent.ACTION_DOWN:
			{
				m_lastTouchX = p_event.getX();
				m_lastTouchY = p_event.getY();
				break;
			}
			case MotionEvent.ACTION_UP:
			{
				break;
			}
			
			case MotionEvent.ACTION_MOVE:
			{
				m_dx = p_event.getX() - m_lastTouchX;
				m_dy = p_event.getY() - m_lastTouchY;
				
				m_posX = m_prevX + m_dx;
				m_posY = m_prevY + m_dy;
				
				if (m_posX > 0 && m_posY > 0 && (m_posX + p_v.getWidth()) < m_alTop.getWidth() && (m_posY + p_v.getHeight()) < m_alTop.getHeight())
				{
					p_v.setLayoutParams(new AbsoluteLayout.LayoutParams(p_v.getMeasuredWidth(), p_v.getMeasuredHeight(), (int) m_posX, (int) m_posY));
					
					m_prevX = m_posX;
					m_prevY = m_posY;
					
				}
				
				break;
				
			}
			
		}
	return true;
}
 
开发者ID:Grishu,项目名称:MYDroid,代码行数:41,代码来源:DragAndDrop.java


示例8: addView

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
/**
 * Add view dynamically for drag and drop
 */
private void addView()
{
	ImageView m_img = new ImageView(m_context);
	TextView m_tv=new TextView(m_context);
	if (m_counter < 5)
	{
		if (m_counter % 2 == 0)
		{
			m_img.setBackgroundResource(R.drawable.bol_green);
			m_tv.setText("Hello! Drag Me! ");
			m_alTop.addView(m_tv, new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, ((int) m_imgXB), ((int) m_imgYB)));
			m_alTop.addView(m_img, new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, ((int) m_imgXB), ((int) m_imgYB)));
		}
		else
		{
			m_img.setBackgroundResource(R.drawable.bol_paars);
			m_alTop.addView(m_img, new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, ((int) m_imgXC), ((int) m_imgYC)));
		}
		m_counter++;
		if (m_counter == 5)
			m_btnAddView.setEnabled(false);
	}
	
	m_img.setOnTouchListener(m_onTouchListener);
	m_tv.setOnTouchListener(m_onTouchListener);
}
 
开发者ID:Grishu,项目名称:MYDroid,代码行数:30,代码来源:DragAndDrop.java


示例9: doLevel

import android.widget.AbsoluteLayout.LayoutParams; //导入依赖的package包/类
void doLevel(LevelCanvas levelView, ZLevel zlevel) {
  int cx = 0;
  int cy = 0;
  int xOffset = 0;
  int yOffset = 0;
  int size = m_RocrailService.Prefs.Size;
  
  if( ModPlan ) {
    xOffset = zlevel.X;
    yOffset = zlevel.Y;
  }

  Iterator<Item> itemIt = zlevel.itemList.iterator();
  while( itemIt.hasNext() ) {
    Item item = itemIt.next();
    
    LevelItem image = new LevelItem(ActLevel.this, levelView, item, size );
    String imgname = item.getImageName(ModPlan);
    if( imgname != null ) {
      Bitmap bMap = BitmapFactory.decodeFile("/sdcard/androc/symbols/"+imgname+".png");
      if( bMap != null ) {
        image.setImageBitmap(bMap);
      }
      else {
        int resId = getResources().getIdentifier(imgname, "raw", "net.rocrail.androc");
        if( resId != 0 ) {
          image.setImageResource(resId);
        }
      }
    }
    
    image.setOnClickListener(item);
    image.setOnLongClickListener(item);
    item.imageView = image;
    item.activity = this;
    
    int x = ModPlan?item.Mod_X:item.X;
    int y = ModPlan?item.Mod_Y:item.Y;

    LayoutParams lp = new LayoutParams(item.cX*size, item.cY*size, (x+xOffset)*size, (y+yOffset)*size);
    if( item.X + item.cX > cx ) cx = item.X + item.cX;
    if( item.Y + item.cY > cy ) cy = item.Y + item.cY;

    levelView.addView(item.imageView, lp);
    
  }
  
}
 
开发者ID:prashant31191,项目名称:andRoc,代码行数:49,代码来源:ActLevel.java



注:本文中的android.widget.AbsoluteLayout.LayoutParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SerDeUtils类代码示例发布时间:2022-05-23
下一篇:
Java MultiGraph类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap