简体   繁体   English

Android Expandable List View Child Focus

[英]Android Expandable List View Child Focus

I have an expandable List View in android with groups and child both as text views, When i touch parent group it is showing different focused states , BUT CHILD DOES NOT SHOW THIS BEHAVIOR. 我在android中有一个可扩展的列表视图,其中组和子级都作为文本视图,当我触摸父组时,它显示了不同的聚焦状态,但是儿童却不显示这种行为。 I think it is problem with focus. 我认为这是重点问题。 Any suggestions. 有什么建议么。

If you are using a Custom Expandable list Adapter: 如果使用“自定义可扩展列表适配器”:

@SuppressLint("UseSparseArrays")
public class MyExpandableListAdapter extends BaseExpandableListAdapter {

    /*
    ....
    */

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {

        return true; //this will be false by default. 
    }
}

您必须在ExpandableListView中添加选择器

android:listSelector="@drawable/button_hover"

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

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