ListView和内部ListView控件按钮 [英] ListView and Buttons inside ListView

查看:184
本文介绍了ListView和内部ListView控件按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示在的ListView A 按钮。 我们的目标应该是点击的ListView 线路或按钮。

I want to display a Button inside the ListView. The goal should be to click on the ListView line or on the button.

点击就可以显示更多的信息就行了。 点击它显示在底部更多的按钮按钮。

Click on the line it shows more info. Click on the button it shows at the bottom more buttons.

同为Gmail应用。

在右侧有一个复选框,并单击底部的复选框后,按钮栏出现。

On the right there is a checkbox and after clicking on the checkbox at the bottom, the button bar appears.

我的问题是插入按钮进入的ListView 后,该按钮无法点击。 如果我添加到的LinearLayout 从按钮 llButton.setClickable()它的工作原理。但是,只有按钮。该的ListView 本身并没有网上的点击反应过来了!

My problem is after inserting the button into the ListView, the button is not clickable. If I add the to the LinearLayout from the button llButton.setClickable() it works. But, only the button. The ListView itself doesn't react on clicks anymore!

我曾尝试<一href="http://stackoverflow.com/questions/1709166/android-listview-elements-with-multiple-clickable-buttons">this例如。

同样的问题,因为上面...

The same issue as above...

推荐答案

如果您使用的是自定义适配器的ListView里面的按钮点击将无法正常工作,所以你应该尝试使用下面的code检查 OnItemClickListener

If you are using a custom Adapter the Button click inside a ListView will not work so you should try to use the following code to check for OnItemClickListener.

listId.setOnItemClickListener(new AdapterView.OnItemClickListener() {
   public void onItemClick(AdapterView<?> list, View v, int pos, long id) {
      // Your code for item clicks
   }
});

这篇关于ListView和内部ListView控件按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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