Android的GridView的项目点击事件处理中ExpandableListView [英] Android GridView Item Click Event Handler Inside ExpandableListView

查看:232
本文介绍了Android的GridView的项目点击事件处理中ExpandableListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ExpandableListView内一个Android GridView控件。所有数据都显示正常,但我不能找到一种方法来处理的GridView项Click事件。我只是想在点击一个网格的单元格中打开另一个意图和价值传递给意向。

这可能吗?

感谢。


解决方案

  YourGrid.setOnItemClickListener(新OnItemClickListener(){
                公共无效onItemClick(适配器视图<>母公司,视图V,
                        INT位置,长的id){
                    意向意图=新意图(这一点,
                            MyNewActivity.class);
                    startActivity(意向);
                }
            });

请确保您的网格布局有像按钮,否则他们就会解雇,而不是这个没有点击量

I have an Android GridView inside an ExpandableListView. All data is appearing fine but I can not find a way to handle GridView Item Click event. I just want to open up another Intent upon clicking on a grid's cell and pass a value to the intent.

Is it possible?

Thanks.

解决方案

YourGrid.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View v,
                        int position, long id) {
                    Intent intent = new Intent(this,
                            MyNewActivity.class);
                    startActivity(intent);
                }
            });

Make sure in your GridLayout there is no clickable content like buttons otherwise they'll fired instead of this

这篇关于Android的GridView的项目点击事件处理中ExpandableListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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