Android RecyclerView将复选框推出屏幕
在使用FastAdapter的Android应用程序中,我试图在RecyclerView下面显示3个复选框 这应该给用户一个可能性,以筛选游戏的赢家,输家,平局名单 但是,全屏幕高度由RecyclerView填充(请原谅下面的非英语文本): 3个复选框仅显示在开头,而数据是通过HTTP加载的。然后它们消失了,就好像回收视图将它们推开或覆盖了一样 下面是我的布局文件,我如何解决我的问题?如果有足够的宽度,我还希望3个复选框在一行中(即一些灵活的布局,可以自动断开行):Android RecyclerView将复选框推出屏幕,android,android-layout,android-recyclerview,android-checkbox,fastadapter,Android,Android Layout,Android Recyclerview,Android Checkbox,Fastadapter,在使用FastAdapter的Android应用程序中,我试图在RecyclerView下面显示3个复选框 这应该给用户一个可能性,以筛选游戏的赢家,输家,平局名单 但是,全屏幕高度由RecyclerView填充(请原谅下面的非英语文本): 3个复选框仅显示在开头,而数据是通过HTTP加载的。然后它们消失了,就好像回收视图将它们推开或覆盖了一样 下面是我的布局文件,我如何解决我的问题?如果有足够的宽度,我还希望3个复选框在一行中(即一些灵活的布局,可以自动断开行): 编辑: 这不是最好的解决
编辑:
这不是最好的解决方案,但很有效。
像这样使用android:layout\u height
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:scrollbars="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<CheckBox
android:id="@+id/wonBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Wins" />
<CheckBox
android:id="@+id/lostBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Losses" />
<CheckBox
android:id="@+id/drawBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Draws" />
</LinearLayout>
</LinearLayout>
编辑:
这不是最好的解决方案,但很有效。
像这样使用android:layout\u height
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:scrollbars="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<CheckBox
android:id="@+id/wonBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Wins" />
<CheckBox
android:id="@+id/lostBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Losses" />
<CheckBox
android:id="@+id/drawBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Draws" />
</LinearLayout>
</LinearLayout>
使用相对布局:
使用相对布局:
不,这导致了一个巨大的列表,其底部有复选框。当我需要的时候,复选框总是在屏幕的底部。不过还是要谢谢你的回答-upvotedOK我误解了你的问题。我编辑了我的答案。不,这会产生一个巨大的列表,在底部有复选框。当我需要的时候,复选框总是在屏幕的底部。不过还是要谢谢你的回答-upvotedOK我误解了你的问题。我编辑了我的答案。不幸的是,复选框覆盖了RecyclerView:@AlexanderFarber我为底部布局添加了android:id=“@+id/llbottom”
,为RecyclerViewHanks添加了android:layout=“@+id/llbottom”
,我很高兴不幸,复选框覆盖了RecyclerView:@AlexanderFarber我为底部布局添加了android:id=“@+id/llbottom”
,为RecyclerView添加了android:layout=“@+id/llbottom”
,我很高兴你的答案更好地解决了我的问题________
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_above="@+id/llbottom"
android:scrollbars="vertical" />
<LinearLayout
android:id="@+id/llbottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<CheckBox
android:id="@+id/wonBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Wins" />
<CheckBox
android:id="@+id/lostBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Losses" />
<CheckBox
android:id="@+id/drawBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Draws" />
</LinearLayout>