ListView和内部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 butt...

我要显示在的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!

我曾尝试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
   }
});