2
"次へ"と "前へ"という2つのボタンがあります。ギャラリーの次の/前の画像に移動してほしいです。これを達成するためにボタンにリスナーを設定するにはどうすればよいですか?ギャラリーの次の画像に移動するためのボタン?
"次へ"と "前へ"という2つのボタンがあります。ギャラリーの次の/前の画像に移動してほしいです。これを達成するためにボタンにリスナーを設定するにはどうすればよいですか?ギャラリーの次の画像に移動するためのボタン?
それはあなたのカスタムギャラリーであれば、あなたは以下の
ような何かを行うことができますonclickの方法で設定された画像
previousButton = (Button) findViewById(R.id.backButton);
previousButton.setOnClickListener(this);
nextButton = (Button) findViewById(R.id.nextButton);
nextButton.setOnClickListener(this);
ボタンに
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
if (view == previousButton) {
--positionOfSelectedImage;
// set background image of
} else if (view == nextButton) {
++positionOfSelectedImage;
}
imageToBeSet.setImageURI(Uri.parse(absolutepathOfImage));
}
おかげ ディーパック
をリスナーを追加します