Android Relativelayout And Onclicklistener
I found many many threads and answers on how to make a Relative layout respond to click event. I've implemented my layout according to them. But still OnClickListener is not called
Solution 1:
Once i had a RelativeLayout
not firing onClick
event and it was because i had a Button
in the middle of it, and the Button
's onClick event was being fired, instead of the RelativeLayout
one. Solved it implementing a listener for both of them:
OnClickListenerlistener=newOnClickListener() {
publicvoidonClick(View v) {
//Handle onClick
}
};
relativeLayout.setOnClickListener(listener);
button.setOnClickListener(listener);
Hope it helps!
Post a Comment for "Android Relativelayout And Onclicklistener"