您的位置:首页 > 产品设计 > UI/UE

RelativeLayout加上android:layout_alignParentBottom="true"让某一部分靠最底部

2016-03-02 19:06 519 查看
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="1/4"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1/2"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="1/4"/>

</LinearLayout>

<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="EditText(充满下方和上方按钮之间的所有屏幕)"
/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="按钮"
android:layout_alignParentBottom="true"/>

</RelativeLayout>

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); //一定要在setContentView之前调用
setContentView(R.layout.activity_main);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: