LinearLayout's click listener is never called

柔情痞子 提交于 2019-12-05 08:00:58
pzulw

Did the click go to the ImageView instead of the LinearLayout? Try clicking in the pad area (if any) or try putting the click listenner on the ImageView1.

pzulw

(adding my response as a new answer so that I can use the PRE tag.)

The easy way is to set the same click listener on the image view and the text view.

View.OnClickListener activityLauncher = new View.OnClickListener() {... }
layout.setOnClickListener(activityLauncher);
imageView.setOnClickListener(activityLauncher);
textView.imageView.setOnClickListener(activityLauncher);

The width of your LinearLayout is set to "0dip", you should see nothing on the screen.

If the width is changed to "FULL_PARENT", that works. Please check your code carefully again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!