当我运行以下布局时,我在 eclipse 中收到编译器警告:
FrameLayout 中的布局参数无效:layout_weight
有什么想法吗?
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView android:id="@+id/list1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
<ListView android:id="@+id/list2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
</FrameLayout>
</LinearLayout>
</TabHost>
最佳答案
从 ListView 中删除 layout_weight 标注(或将它们包装在线性布局中)。
正如它告诉您的那样,当直接父布局是框架布局时它是无效的。
关于android - FrameLayout : layout_weight 中的布局参数无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10906850/