標籤:android實現綜合布局
650) this.width=650;" src="http://s1.51cto.com/wyfs02/M02/8B/49/wKioL1hJCTrQbAorAAHeWdhDusU595.png-wh_500x0-wm_3-wmp_4-s_1480552663.png" title="捕獲.PNG" alt="wKioL1hJCTrQbAorAAHeWdhDusU595.png-wh_50" />
要實現這種效果,
-
LinearLayout的嵌套實現 2.使用RelativeLayout
-
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="10dp" android:paddingRight="10dp" > <EditText android:id="@+id/EditText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reminder" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <EditText android:id="@+id/dates" android:layout_width="0dp" android:layout_height="wrap_content"android:layout_weight="1" /> <EditText android:id="@+id/times" android:layout_width="100dp" android:layout_height="wrap_content" /> </LinearLayout> <Button android:id="@+id/button1" android:layout_width="96dp" android:layout_height="wrap_content" android:layout_gravity="right" android:text="提交" /></LinearLayout>
-
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="10dp" android:paddingRight="10dp" > <EditText android:id="@+id/EditText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/reminder" /> <EditText android:id="@+id/dates" android:layout_width="wrap_content" android:layout_height="wrap_content"android:layout_below="@id/EditText1"android:layout_alignParentLeft="true" android:layout_toLeftOf="@+id/times" /> <EditText android:id="@+id/times" android:layout_width="100dp" android:layout_height="wrap_content"android:layout_below="@+id/EditText1"android:layout_alignParentRight="true" /> <Button android:id="@+id/button1" android:layout_width="96dp" android:layout_height="wrap_content" android:layout_below="@id/times" android:layout_alignParentRight="true" android:text="提交" /> </RelativeLayout><!-- android:layout_alignParentLeft="true" 和父控制項靠左對齊android:layout_toLeftOf="@+id/times" 在指定組件左邊android:layout_below="@id/EditText1" 在指定組件下邊 -->
本文出自 “matengbing” 部落格,請務必保留此出處http://matengbing.blog.51cto.com/11395502/1880754
android實現綜合布局