TextIsSelectable property not working with toolbar
I have a normal TextView with android: textIsSelectable property true. This worked great even if I have a TextView inside a ListView. But now I decided to use the new Toolbar as my ActionBar and it doesn't work anymore. I have no glitch or anything, I only see screen flickering on Lollipop devices when I press the TextView for a long time. On devices before Lollypop, I can't see anything.
Does anyone else have another problem and is there a fix for it?
+3
source to share
3 answers
Try it, this worked for me:
In the toolbar layout, add the text view yourself, for example:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text = "Hi, there"
android:textColor="#ff0000"
android:textIsSelectable="true"/>
</android.support.v7.widget.Toolbar>
I tested this on android v4.0.4 ICS, it works great for me, I can select text on long press.
Hope it helps ...
-1
source to share