Tuesday, 10 September 2013

working with two ImageView in android

working with two ImageView in android

This is my ImageViews. The @id/imgUSER is behind the @id/imgBG. But when I
click on imgUSER it does not respond.. but when I remove the imgBG and
test it, and click imgUSER again then it works. Is there anyway that I can
click imgUSER if the imgBG is visible or present?
<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" />
Heres my code for listerner
imgUSER.setOnClickListener(listener);
....
public OnClickListener listener = new 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;
}

No comments:

Post a Comment