Android provides the OnClick property for view in the layout file, using the following methods:
<textview
android:id= "@+id/user"
android:layout_width= "@dimen/px_171" android:layout_height= "
Fill_parent "
android:onclick=" Iconclicklistener "
android:clickable=" true "/>
<textview
Android:id= "@+id/cinema"
android:layout_width= "@dimen/px_220"
android:layout_height= "Fill_parent"
android:layout_gravity= "right"
android:onclick= "Iconclicklistener"
/**
* Click event
* @param v/public
void Iconclicklistener (View v) {
if (v.getid () = R.id.user) { C21/>}else if (v.getid () = = R.id.cinema) {
}
Note that the layout file adds clickable=true to the TextView (textview default is False), so that it works.
The above is a small series for everyone to bring Android using TextView, set the onclick properties of the invalid solution to all the content, I hope that we support cloud-Habitat Community ~