Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextView intercepting touch events while scrolling in ViewPager

Tags:

android

There's a TextView inside a ViewPager, when the ViewPager is scrolled from a portion near TextView the scroll event is intercepted by TextView itself.

This TextView is in relative layout of fragment in ViewPager

<TextView

                android:id="@+id/tv_course_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Example Course"
                android:singleline="true"
                android:ellipsize="marquee"
                android:marqueeRepeatLimit="marquee_forever"
                android:gravity="center"
                android:textColor="@color/black"
                android:textSize="15sp"
                android:textStyle="bold"/>
like image 215
shreedhar Avatar asked Feb 06 '17 10:02

shreedhar


Video Answer


1 Answers

Try replacing android:singleLine="true" with android:maxLines="1"

Happy Coding.

like image 95
Utsav Shrestha Avatar answered Oct 13 '22 03:10

Utsav Shrestha