可疑的大小这将使视图不可见(在子布局中)
Suspicious size this will make the view invisible (in child layout)
我在 LinearLayout 中有一个子 LinearLayout
内部布局显示一条消息说
大小可疑,这会使视图不可见
我已经将布局的方向设置为父布局是垂直的,内部布局是水平的我还将其中控件的 layout_height 设置为 0dp 并设置了权重
不知道为什么?
这是我的 xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/filter_ShowOnlyAvailableItems_Chk"
android:layout_width="match_parent"
android:text="@string/Search_ShowOnlyAvailableItems"
android:layout_height="0dp"
android:layout_weight="0.3"/>
<CheckBox
android:id="@+id/filter_Color_Chk"
android:layout_width="match_parent"
android:text="@string/Search_FilterColor"
android:layout_height="0dp"
android:layout_weight="0.3"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.86">
<android.support.v7.widget.RecyclerView
android:id="@+id/filter_colors_recyclerview"
android:layout_width="match_parent"
android:background="@color/red"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</ScrollView>
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"/>
<Button
android:id="@+id/filter_ok_btn"
android:text="@string/Filter_Ok"
android:layout_width="0dp"
android:textColor="@android:color/black"
android:layout_weight="0.50"
android:layout_margin="5dp"
android:textAlignment="center"
android:background="@drawable/buttonrounded"
android:layout_height="wrap_content" />
<Button
android:id="@+id/filter_cancel_btn"
android:text="@string/Filter_Cancel"
android:layout_width="0dp"
android:layout_margin="5dp"
android:textColor="@android:color/black"
android:layout_weight="0.50"
android:textAlignment="center"
android:background="@drawable/buttonrounded"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
您已在此处关闭 linearlayout。
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"/>
将此更改为
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8">
我在 LinearLayout 中有一个子 LinearLayout
内部布局显示一条消息说
大小可疑,这会使视图不可见
我已经将布局的方向设置为父布局是垂直的,内部布局是水平的我还将其中控件的 layout_height 设置为 0dp 并设置了权重
不知道为什么?
这是我的 xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/filter_ShowOnlyAvailableItems_Chk"
android:layout_width="match_parent"
android:text="@string/Search_ShowOnlyAvailableItems"
android:layout_height="0dp"
android:layout_weight="0.3"/>
<CheckBox
android:id="@+id/filter_Color_Chk"
android:layout_width="match_parent"
android:text="@string/Search_FilterColor"
android:layout_height="0dp"
android:layout_weight="0.3"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.86">
<android.support.v7.widget.RecyclerView
android:id="@+id/filter_colors_recyclerview"
android:layout_width="match_parent"
android:background="@color/red"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</ScrollView>
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"/>
<Button
android:id="@+id/filter_ok_btn"
android:text="@string/Filter_Ok"
android:layout_width="0dp"
android:textColor="@android:color/black"
android:layout_weight="0.50"
android:layout_margin="5dp"
android:textAlignment="center"
android:background="@drawable/buttonrounded"
android:layout_height="wrap_content" />
<Button
android:id="@+id/filter_cancel_btn"
android:text="@string/Filter_Cancel"
android:layout_width="0dp"
android:layout_margin="5dp"
android:textColor="@android:color/black"
android:layout_weight="0.50"
android:textAlignment="center"
android:background="@drawable/buttonrounded"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
您已在此处关闭 linearlayout。
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"/>
将此更改为
<LinearLayout
android:padding="5dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8">