android - FrameLayout : layout_weight 中的布局参数无效

标签 android android-layout

当我运行以下布局时,我在 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/

相关文章:

android - 发布 Alpha 新 Android 游戏时如何将 "Link App"转换为现有客户端 ID 和生产 SHA1

java - 将行动态添加到单独文件中的表布局

android - 列出 Intent 的所有额外内容

java - 如何在 Libgdx Java 中实现缩放和平移?

java - 操作栏 - 拖动菜单项

android - ScrollView 自动滚动到可选择的 TextView

android - 当所需输入大于 String length() 中的 ~4000 时设置 TextView 的文本

android - 如何在android中的 ImageView 中显示具有固定Uri的图像

android - 在两个不同的布局之上重叠 circleView

android - 显示来自 SD 卡或内部存储的图像以查看寻呼机 android