Android ImageView over ImageView OnTouchListener -
well have 2 imageviews , this. want add touchlistener imageview1. listener not working properly. adding imageview2
android:focusable="false"
but not working again
try this. works me correctly when click on imageview2. mainactivity oncreate():
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imageview imageview1 = (imageview) findviewbyid(r.id.imageview1); imageview1.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { // todo auto-generated method stub log.i("imageviewandontouchlistener", "imageview1 ontouch"); return false; } }); }
and in layout xml:
<framelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image1"/> <imageview android:id="@+id/imageview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/image2" /> </framelayout>
Comments
Post a Comment