我必须implementing
a RecylerView
,它应该包含内容,如果它只包含项目内容高度较少.如果项目的增加喜欢250dp
,它应该设置为max heght(250dp)
并且能够滚动.如何实现这个Relative layout
.我的父布局是一个.
这是我的布局文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
屏幕截图,如果它只有一个项目.这应该是wrap_content.