简体   繁体   English

将TextView滚动到屏幕外

[英]Scroll a TextView out the screen

I have a bit of a predicament. 我有点困境。

My Layout is currently this: 我的布局当前是这样的:

<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>

The TextView is dynamic content set by the server and it can be really long sometimes. TextView是服务器设置的动态内容,有时可能会很长。

The problem I am having is the TextView can take up the whole screen. 我遇到的问题是TextView可以占用整个屏幕。 This XML is a fragment that is in a TabLayout with a collapsable toolbar. 此XML是TabLayout中带有可折叠工具栏的片段。 So when I scroll the content I would like the TextView to scroll out the screen, if this is possible. 因此,当可以滚动内容时,我希望TextView滚动出屏幕。 I tried to embed the Textview in a scrollView but this doesn't work as you see about? 我试图将Textview嵌入scrollView中,但是如您所见,这不起作用?

Got any ideas how I can still have the CollapsableToolbar collapse as well as scroll the Textview out the screen to reveal the RecyclerView? 有什么想法我仍然可以让CollapsableToolbar折叠以及如何将Textview滚动到屏幕上以显示RecyclerView?

Thank you 谢谢

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM