これは私のImageViews
です。@id/imgUSERは @id/imgBG の背後にあります。しかし、imgUSERをクリックしても応答しません。しかし、imgBGを削除してテストし、imgUSERをもう一度クリックすると動作します。imgBGが表示されているか存在している場合、imgUSERをクリックできる方法はありますか?
<ImageView
android:id="@+id/imgUSER"
android:layout_width="285dp"
android:layout_height="185dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="120dp"
android:background="@android:color/background_dark"
android:src="@android:drawable/ic_menu_gallery" />
<ImageView
android:id="@+id/imgBG"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="32dp"
android:src="@drawable/products" />
リスナーのコードはこちら
imgUSER.setOnClickListener(リスナー);
....
public OnClickListener リスナー = 新しい OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.imgUSER :
imgUSER.setBackgroundResource(R.id.bgProduct_1);
break;
}