I have a TextView
with an 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 android:ellipsize
and android:maxLines
tags - 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 the commented functionality, but even when this lines are commented I still see how the textview blinks.
The text just disapears when i place my finger on the screen and apears when I take the finger away.
Android uses a selector to give different colors to widgets' pressed state.
If you don't want that behavior, you can use solid colors for android:textColor
and android:textColorHighlight
.
Check the TextView doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With