Android: show child view on touch event -
im quite new android dev. i'm trying show child view on parent view click or select. code:
<relativelayout android:id="@+id/relative_button" android:layout_width="match_parent" android:layout_height="52dp" android:onclick="login_click"> <imageview style="@style/button_image" android:id="@+id/button_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/signin" android:contentdescription="@string/button_icon" android:layout_centervertical="true" android:layout_toleftof="@+id/textview" android:visibility="invisible"/> <com.ontheway.app.textviewplus style="@style/button_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_login" android:id="@+id/textview" /> </relativelayout> at moment imageview invisible. show on click or select of parent relativelayout. i'm wondering if can done through selector or have in java , if it's better add imageview dynamically or leave in xml now? help.
with onclick attribute, entire layout respond clicks. should work fine. whether put imageview here or dynamically add in java seems more personal preference rather hard rule
Comments
Post a Comment