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

来源:互联网 发布:一根网线几个淘宝店铺 编辑:程序博客网 时间:2024/05/17 15:22
<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>

@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);  //一定要在setContentView之前调用setContentView(R.layout.activity_main);}





0 0
原创粉丝点击