Non scrollable textview in android
Asked Answered
A

3

9

I have a textview configured in my XML as below.

<RelativeLayout>
   <!-- more views here like ImageView and other TextView-->
    <TextView
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:maxLines="4"
        android:textIsSelectable="false"
        android:autoLink="web|phone|email"/>
</RelativeLayout>

The content for this view could be text and may also contain HTML content. Hence I have set autoLink to true. The issue is, if either the autoLink or the textIsSelectable is true, then the textview starts to scroll similar to(MovementMethod) when its content is more than 4 lines. I am looking for a way to stop/disable this textview scrolling.

I tried to disable the scrolling using setEnable(false) for the text view, however, all the links in the textview could not be clicked thereafter.

I think there has to be a straight forward way to achieve "non-scrollable textview" which may contain HTML content in them.

Anders answered 30/5, 2013 at 10:56 Comment(0)
S
0

I think you can add the attribute android:nestedScrollingEnabled="false" to any View child. At least, I use android:nestedScrollingEnabled="true" to make my TextViews scrollable. Hope this solves your problem.

BTW, why are you trying to display a clickable link when you can't even scroll to look at the entire link? Just asking out of curiosity.

Smiga answered 20/11, 2020 at 11:47 Comment(0)
E
-2

set ellipsize to the text view so text can't be greater than 4 lines

may be this is solution for you

Eydie answered 30/5, 2013 at 11:16 Comment(0)
S
-2

Try changing 'Relative Layout' to 'Table layout'... If this doesn't work then try to set appropriate padding and margin for Textview and other widgets.

Septuor answered 30/5, 2013 at 11:24 Comment(1)
changing layout dint work. the issue stays. neither setting padding helped.Anders

© 2022 - 2024 — McMap. All rights reserved.