谢谢!

解决方案 »

  1.   

    可以,用padding
    <LinearLayout android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:paddingLeft="100px"
       android:paddingTop="100px">你的imagebutton放在这个位置</LinearLayout>
      

  2.   

    那如果是通过代码创建的imagebutton呢?
      

  3.   

    先在XML定义好LinearLayout<LinearLayout android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:paddingLeft="100px"
       android:paddingTop="100px"
    ></LinearLayout>
      

  4.   

    直接代码方式如下:        Button bt1 = new Button(this);
            bt1.setText("按钮");
            bt1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));        
            
            LinearLayout linearlayout1 = new LinearLayout(this);
            linearlayout1.setPadding(100, 100, 0, 0);
            linearlayout1.addView(bt1);
            addContentView(linearlayout1,new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));