在扩展列表视图android的按钮 [英] button in expandable listview android

查看:139
本文介绍了在扩展列表视图android的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义适配器ExpandableListActivity。

i have a ExpandableListActivity with an custom Adapter.

如果适配器的自定义行包含imageViewall做,但如果我从ImageView的改变这个视图的ImageButton,可扩展列表视图不扩大。

if the custom row of the adapter contains a imageViewall is done, but if i change this view from imageView to imageButton, the expandable listview don't expand.

有没有什么方法将可以点击一个按钮,expandablelist不输功能拓展?

Is there any method to put a button that can be clicked and the expandablelist does not lose the functionality to expand?

推荐答案

按钮应该是没有focuseable。在你listView.setOnItemClickListener(不在XML布局!!):

The button should be no-focuseable. In your listView.setOnItemClickListener (not in xml layout!!) :

Button button = (Button) view.findViewById(R.id.yourButton); 
//where button is the button on listView, and view is the view of your item on list

button.setFocusable(false);   /// THIS IS THE SOLUTION

button.setOnClickListener(new Button.OnClickListener() {
    public void onClick(View v) {
        //button functionalty   ...
    }
});

这篇关于在扩展列表视图android的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆