我在代码中创建了很多控件,控件的位置是有X、Y坐标来摆放的,在LinearLayout中摆放是发觉它是横着摆放的,并没有按着我想的那样摆放,用RelativeLayout来摆放时它都放在了左上角处。怎么去设置它的摆放位置是我所想的那样。
button.layout(x,y,page.width-x,page.height-y);
这个是我放置它在哪的代码AndroidUI摆放位置
button.layout(x,y,page.width-x,page.height-y);
这个是我放置它在哪的代码AndroidUI摆放位置
你先试着把x.y布局控件放在AbsoluteLayout中试试
android:id="@+id/center_lay"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/before_play_loading_txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20px"
android:gravity="center"
android:background="#303030"
android:text="@string/current_status_str" />
</RelativeLayout>在Textview 中你可以用android:layout_marginTop=""
android:layout_marginRight=""
android:layout_marginLeft=""
来试试效果,自然就知道怎么调节位置了
android:layout_toRightOf
android:layout_toLeftOf
android:layout_below
等属性