Android: setOnClickListener for children of RelativeLayout -
i use relativelayout
but children of layout not work settext , click , ...
how fixed ?
code :
imageview imageview01 = (imageview) findviewbyid(r.id.imageview01); if (imageview01 != null) { imageview01.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { log.i("error", "q" + 108); } }); }
this code linearlayout child of relativelayout
xml :
<linearlayout android:id="@+id/lnrvideocontrol" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <imageview android:id="@+id/imgplayvideo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.5" android:focusable="false" android:src="@drawable/play" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="15dp" android:layout_marginright="15dp" android:layout_margintop="5dp" android:layout_weight="0.5" android:gravity="center" > <seekbar android:id="@+id/seekbarvideo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="7dp" android:layout_margintop="2dp" android:layout_weight="0.5" android:paddingleft="8dp" android:paddingright="8dp" android:progressdrawable="@drawable/red_scrubber_progress" android:thumb="@drawable/red_scrubber_control_thin" android:thumboffset="8dp" /> </linearlayout>
if use code out of relativelayout worked full !
how fix problem ?
you have imageview id imgplayvideo
. creating reference other imageview.
imageview imageview01 = findviewbyid(r.id.imageview01)
this might wrong reference. correct code , refer exact imageview
imageview imageview = findviewbyid(r.id.imgplayvideo)
this might fix issue.
Comments
Post a Comment