Ad
TextView Marquee WITHOUT Android:layout_width="match_parent"
I am making a UI which will look like this
My goal is to add marquee scroll effect in highlighted text views, The parent container for the both text view is Constraint layout, Hence I am using android:layout_width="0dp"
so that my view expands to its constraints that is 50-50 of the total space.
I did some research and found that I need android:layout_width="match_parent"
in order to achieve marque.
My current code for marquee:
<TextView
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:singleLine="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:scrollHorizontally="true"
android:gravity="start"
android:id="@+id/row_load_list_toAddress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="End Location"
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView5"
app:layout_constraintTop_toBottomOf="@+id/textView13" />
Anyone please put a light on what I might be doing wrong here and what is the solution?
Ad
Answer
Inorder for the marquee to work you must set setSelected
property to true in your Activity related to that layout
TextView txt = findViewById(R.id.row_load_list_toAddress);
txt.setSelected(true);
Hope this will fix your problem.
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad