如何获得类似的布局
底部元素的高度是 wrap_content,但嵌套布局 Eclipse 提示我nested weights are bad for performance
如何获得类似的布局
底部元素的高度是 wrap_content,但嵌套布局 Eclipse 提示我nested weights are bad for performance
那是权重为 1 的垂直线性布局和嵌套的水平线性布局,内容高包装,权重 1 宽。是的,嵌套权重对性能不利,但如果这是您需要的,那就是您所需要的。正如 Moecklin 先生指出的那样,就您而言,这可能并不重要。
编辑添加:
你可能已经有了这个:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1" />
<TextView
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>