@ZeroGeek
2015-08-27T04:27:39.000000Z
字数 939
阅读 788
android
参考:http://developer.android.com/guide/topics/ui/layout/linear.html
<?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">
<EditText
android:id="@+id/one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="one" />
<EditText
android:id="@+id/two"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="two" />
</LinearLayout>
在上述xml中。two的layout_height值设置为任意值都不会影响布局结果,一般我们设置为0dp。
当我们把layout_width 或 layout_height 的值设置为负值时,系统会按照 warp_content 处理。