画像をクリック可能にして、画像を押すとユーザーが別のページまたはリンクに移動できるようにしようとしています。
どうすればこれを達成できますか?現在、の各行にGridView
は2がありButtons
ます。GridView
クリックされたアイテムに固有の特定のアクションを実行するために、のどのアイテムがクリックされたかをどのように知るのでしょうか。
助けてくれてありがとう!
これは私のイメージアダプタクラスにあります:
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
imageView = new ImageView(mContext);
imageView.setAdjustViewBounds(true);
// imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
imageView.setPadding(4, 8, 4, 8);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
return imageView;
}
// references to our images
private Integer[] mThumbIds = {
R.drawable.menu_about,R.drawable.menu_episodes
};
}