【发布时间】:2015-08-11 22:13:43
【问题描述】:
我正在尝试设计一个在顶部有标题和一些文本的布局,然后在其下方有一个 RecyclerView 的 cmets。文本可能会很长,因此我将其放入ScrollView。我的代码导致TextViews 和RecyclerView 相互重叠:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textSize="18sp"
android:textStyle="bold"
android:paddingBottom="5dp"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_below="@id/title"
android:paddingTop="5dp"
/>
</RelativeLayout>
</ScrollView>
<android.support.v7.widget.RecyclerView
android:id="@+id/commentlist"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
【问题讨论】:
标签: android android-layout scrollview android-recyclerview