ここで私はいくつかの画像のボタンがあるだろうということの背景とトップとしてImageViewのを持っています。このXMLにアンドロイドのEventListener
<FrameLayout android:id="@+id/LayoutTab"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_marginBottom="-30dip">
<ImageView android:id="@+id/ImageMenu" android:background="@drawable/img_tab"
android:layout_height="wrap_content" android:layout_width="fill_parent"></ImageView>
<LinearLayout android:id="@+id/LinearLayout03"
android:layout_width="fill_parent" android:paddingLeft="5dip"
android:layout_height="wrap_content" android:layout_gravity="bottom">
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/btnNegative"
android:background="@drawable/btn_minus_state" android:layout_margin="5dip"></ImageButton>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/btnPositive"
android:background="@drawable/btn_plus_state" android:layout_margin="5dip"></ImageButton>
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/btnShare"
android:background="@drawable/btn_share_state" android:layout_margin="5dip"></ImageButton>
</LinearLayout>
</FrameLayout>
を確認してください。今私は画像ビュー& imagebuttonsにeventListener(OnClickListener)を実装したいと思います。しかし、ボタンをクリックすると、そのイベントは画像ビュー(バックグラウンドにあります)にも移動します。この状況をどのように処理するのですか?
編集:OPはたぶんあなたのImageView
ので、すべてのイベントがImageView
に行く、それは完全にあなたのLinearLayout
不明瞭FrameLayout
でそう非常に大きいコメント
mnuTab = (ImageView) this.findViewById(R.id.ImageMenu);
btnmin = (ImageButton) this.findViewById(R.id.btnNegative);
btnplus = (ImageButton) this.findViewById(R.id.btnPositive);
btnShare = (ImageButton) this.findViewById(R.id.btnShare);
mnuTab.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// my functions
}
});
btnmin.setOnClickListener(new OnClickListener() {
public void onClick(View v) { }
});
btnplus.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// my functions
}
});
また、imageButtonのonClickListenerのimageViewが呼び出されてから、imageViewの画像が表示されますか?その場合、imageButtonのonClickListenerにtrueを返し、イベントを消費し、imageViewに送信されないようにする必要があります。 – ByteMe
imagebuttonは決して呼び出されません。画像ビューのみがトリガーされています – Jram
リスナーで何かが正しく設定されていないようです。これらのコールバックを設定するJavaコードを提供できますか? – Devunwired