本文介绍了项目单击侦听器上的 GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
gridView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
Toast.makeText(ScenesActivity.this, position + "#Selected",
Toast.LENGTH_SHORT).show();
final Intent intent = new Intent(getApplicationContext(), ScenesDetailActivity.class);
intent.putExtra(TestConstants.SELCTED_SCENE_KEY, position);
startActivity(intent);
}
});
TestConstants.java
TestConstants.java
public interface TestConstants {
String SELCTED_SCENE_KEY="SELCTED_SCENE"; }
我想在单击选定的场景键后获取 ScenesDetailActivity.上面的代码似乎没有按预期工作.有人可以帮我解决它吗?非常感谢!西蒙尼德斯
I want to get ScenesDetailActivity after click the slected scene key. It seems that the above code doesn't work as expected. Can someone help me to slove it? Thanks a lot! Simonides
推荐答案
gridView 是否有自定义布局?
does the gridView have a custom layout ?
如果是,转到自定义布局xml文件并更改这些属性
if yes, go to the custom layout xml file and change these attributes
android:clickable="false"
android:focusable="false"
这篇关于项目单击侦听器上的 GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!