RecyclerView是网格显示的,数据大于1行,然后显示不全;
前后对比了代码,发现是 LinearLayout 中添加了 android:layout_marginBottom 导致的:
示例图:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_my_app"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/kd_enet_white"
tools:visibility="gone" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
方法:删除marginBottom后就能完全显示:(Don’t ask why. Just do it!):
android:layout_marginBottom="10dp"