我有点困境。
我的布局目前是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/item_shipping_shipping_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|left"
android:padding="@dimen/margin_16"/>
<View
android:id="@+id/line43"
android:layout_width="match_parent"
android:layout_height="@dimen/line_height"
android:background="@color/light_gray"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.RecyclerView
android:id="@+id/item_shipping_fragment_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:isScrollContainer="true"/>
</LinearLayout>
TextView是服务器设置的动态内容,有时可能很长。
我遇到的问题是TextView可以占用整个屏幕。此XML是具有可折叠工具栏的TabLayout中的片段。因此,当我滚动内容时,我希望TextView滚出屏幕,如果可能的话。我试图将Textview嵌入到scrollView中,但这不会像你看到的那样工作吗?
有任何想法我仍然可以让CollapsableToolbar崩溃,并将Textview滚动到屏幕上以显示RecyclerView?
谢谢
答案 0 :(得分:0)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true">
<TextView
android:id="@+id/item_shipping_shipping_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|left"
android:padding="@dimen/margin_16"/>
</android.support.v4.widget.NestedScrollView>
<View
android:id="@+id/line43"
android:layout_width="match_parent"
android:layout_height="@dimen/line_height"
android:background="@color/light_gray"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/item_shipping_fragment_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:isScrollContainer="true"/>
</LinearLayout>