Skip to content Skip to sidebar Skip to footer

Android Textview Disappears When Clicked

I have a TextView with the android:onClick attribute. When clicked, the TextView disappears. I don't want the TextView to disappear when clicked. Any ideas? Edit:

Solution 1:

I thought I had the same problem but it turned out the textview was not dissapearing, rather the color was changing so that it was the same as the background color. Thus it appeared hidden but it really was there. You can set the clicked color of the text view by setting it's color state list resource

http://developer.android.com/guide/topics/resources/color-list-resource.html

Solution 2:

Have you registered a method processClick? There is no need to do it this way. Remove the clickable property and also onClick property. More simple approach is to set onClick listener from the code, for example in onCreate method:

TextViewtext= (TextView) findViewById(textView1);
text.setOnClickListener(newOnClickListener() 
{
    @OverridepublicvoidonClick(View v) 
    {
        // Do some job here

    }
});

The view becomes clickable automatically when you set an on click listener. Good luck

Post a Comment for "Android Textview Disappears When Clicked"