How to disable textview onClick blinking

I have a TextView with onClickListener() . When I click on the TextView , it blinks. How to disable this effect?

Here is the XML

 <TextView android:id="@+id/descriptionText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/background" android:ellipsize="end" android:paddingTop="4dp" android:paddingLeft="8dp" android:maxLines="3" /> 

I tried to remove the android:ellipsize and android:maxLines - no effect.

And here is the code:

 accountDescriptionTextView = (TextView) v.findViewById(R.id.descriptionText); accountDescriptionTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (descriptionOpened) { // accountDescriptionTextView.setEllipsize(TextUtils.TruncateAt.END); // accountDescriptionTextView.setMaxLines(3); descriptionOpened = false; } else { // accountDescriptionTextView.setEllipsize(null); // accountDescriptionTextView.setMaxLines(100); descriptionOpened = true; } } }); 

I need to have commented functionality, but even when these lines are commented out, I still see how the text is viewed.

The text just disappears when I press my finger on the screen and appears when I remove my finger.

+4
source share
1 answer

Android uses a selector to give different colors when widgets are pressed.

If you do not want this behavior, you can use solid colors for android:textColor and android:textColorHighlight .

Check out the TextView document .

+4
source

All Articles