Linear layout clickable error -
in andoid app. have clickable linear layout i've generated programmaticly, , want turn green when pressed indicate clickable, button would. how go doing this?
this code implemented in header layout.
<linearlayout android:id="@+id/back_lay" android:layout_width="46dp" android:layout_height="46dp" android:layout_marginleft="10dp" android:background="@android:color/transparent" android:gravity="center_vertical|center_horizontal" > <button android:id="@+id/ib_back_music" android:layout_width="30dp" android:layout_height="32dp" android:layout_marginleft="5dp" android:background="@drawable/back_btn_sel" android:clickable="true" android:gravity="center_vertical|center_horizontal|center" /> </linearlayout>
private linearlayout llinearlayout; //oncreate llinearlayout = (linearlayout) findviewbyid(r.id.back_lay); llinearlayout.setonclicklistener(new { @override public void onclick(view v) { llinearlayout.setbackgroundcolor(color.black); } });
Comments
Post a Comment