Java 类android.widget.AbsoluteLayout.LayoutParams 实例源码

项目:cn1    文件:TextView.java   
@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));
    }
}
项目:cn1    文件:ImageView.java   
@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));
}
项目:cn1    文件:Button.java   
@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));
    }
}
项目:andRoc    文件:ActLevel.java   
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);
    }
  }
}
项目:xinbo_android    文件:RuanActivity10.java   
@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);
}
项目:letv    文件:ProgressWebView.java   
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));
}
项目:letv    文件:ProgressWebView.java   
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);
}
项目:MYDroid    文件:DragAndDrop.java   
@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;
}
项目:MYDroid    文件:DragAndDrop.java   
/**
 * 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);
}
项目:andRoc    文件:ActLevel.java   
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);

  }

}