android - onClickListener on a LinearLayout -
There is a problem with a functionality that I want to apply.
I want to set a onClickListener on a LinearLayout , which includes 2 TextViews , so that it's a Treat it as an item in ListView .
I have tried some possible implementation of this, and it has XML attribute android: onClick of LinearLayout .
is working, as I want to visually rehearse the application, click LinearLayout (like ListView ), I've put it in the listener callback method:
l.setBackgroundColor (android .Redrawable.list_selector_background); l a linearLayout object, findViewById () ;
Whenever I try to click on Layout I tried to change the code in a callback method by a toast message, and it works, so I think the problem Is in setBackgroundColor .
Is anyone aware of this?
PS: Sorry, I can not post more codes now, I am at work.
you have linearLayout attribute android: clickable = "true" / Code> must be set in the XML layout file or setClickable (true) in the Java Activity code.
Comments
Post a Comment