0

In my scrollview, I have a textview with multilines, since in the code the text was set with maximum characters of 200, so I would like to always show all the text inside the textview as at most there are only 6 lines of text.

But the problem is when I touch the multiline textview, it disables the scrolling of it's parent. I would like to touch the textview and scroll it then the screen could go up and down, but right now it just stop in the textview and only if I touch the very right edge to find the scrollbar. I have tried to find the answers here, and mostly the pages are about how to add scrollview inside a textview that is not my case.

Any suggestions?

Here is the xml:

<com.example.VerticalScrollview      xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F7F7F7"
tools:context="com.example.EventDetailActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        android:id="@+id/eventDescription"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine"
        android:textColor="@android:color/secondary_text_dark_nodisable"
        android:layout_marginTop="20dp"
        android:typeface="monospace"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_marginBottom="20dp"
        android:textStyle="italic"/>

</LinearLayout>

</LinearLayout>
</com.example.VerticalScrollview>

I haven't posted all of the xml, but above would be the one matters, remains are just other LinearLayout, Buttons, TextView, ImageView etc.

Pengzhi Zhou
  • 481
  • 1
  • 6
  • 24
  • post your xml please – IntelliJ Amiya Aug 26 '15 at 13:55
  • @IntelliJAmiya as suggested, xml has been attached – Pengzhi Zhou Aug 26 '15 at 14:03
  • @Penghazi Try to wrap the linearlayout into a nestedscrollview instead – Mohamed Allam Aug 26 '15 at 14:09
  • @MohamedAllam do you mean change the VerticalScrollview to nestedscrollview? the reason I used VerticalScrollview is there are still some listviews inside the scrollview which is scrollable as well. The VerticalScrollview is a class provided by "XYZ" from this post: http://stackoverflow.com/questions/3495890/how-can-i-put-a-listview-into-a-scrollview-without-it-collapsing/3495908#3495908 – Pengzhi Zhou Aug 26 '15 at 14:24

1 Answers1

0

Problem solved by changing android:inputType="textMultiLine" to: android:maxLines="8"

It looks like android:inputType disable the scrolling although still no idea why that happened. As my text characters won't be more than 200, then just change it to android:maxLines and problem solved. Tricky problem easy answer.

Pengzhi Zhou
  • 481
  • 1
  • 6
  • 24