use*_*963 1 java android 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);
}
});
Run Code Online (Sandbox Code Playgroud)
TestConstants.java
public interface TestConstants {
String SELCTED_SCENE_KEY="SELCTED_SCENE"; }
Run Code Online (Sandbox Code Playgroud)
我想在点击选定的场景键后获得ScenesDetailActivity.看来上面的代码没有按预期工作.有人能帮助我解决它吗?非常感谢!西蒙尼德
gridView有自定义布局吗?
如果是,请转到自定义布局xml文件并更改这些属性
android:clickable="false"
android:focusable="false"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12493 次 |
| 最近记录: |