简体   繁体   English

按钮在可扩展ListView中无法单击

[英]Button is not clickable in the Expandable ListView

I have Expandable listview Which contain button, When I click on button the click event is not triggering because button focus is set to false. 我有可扩展的列表视图,其中包含按钮,当我单击按钮时,单击事件不会触发,因为按钮焦点设置为false。 First I have set button focus false in the xml layout and then based on the existing posts I have changed that and set focusable to false dynamically. 首先,我在xml布局中设置了按钮焦点false,然后根据我已更改的现有帖子并动态地将focusable设置为false。 But the in the two scenario's button is not clickable. 但是在两个场景的按钮中是不可点击的。 I have tried setting focusable false after setting the onclickListener to the button in the getGroupView method method but the still the button is not click.. Any help Appriciated. 我已经尝试在将onclickListener设置为getGroupView方法方法中的按钮后设置focusable false,但仍然没有单击按钮..任何帮助Appriciated。

If the button is in the group row then 1. set Focusable true in your xml file for button 2.set focusable to false after setting the onClickListener for the button 3. and the important one is in your grouprow.xml file try to set 如果该按钮位于组行中,则1.在设置按钮3的onClickListener后,将按钮2.set的可聚焦设置为true,将其设置为false,并将重要的一个放在grouprow.xml文件中尝试设置

android:descendantFocusability="blocksDescendants"

for the View group. 对于View组。 This should work. 这应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM