android - Text View on click listener -
i have 3 text view on page , each of them has on click method. when click on each of them,text view3 called. wrong?
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="com.card.admin.nfcapp.readcertificateactivity" android:id="@+id/test"> <textview android:id="@+id/dipcert1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textsize="30dp" android:text="@string/cert1" android:gravity="center" android:paddingbottom="200dp" android:onclick="btnclicklistener1 /> <textview android:id="@+id/dipcert2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textsize="30dp" android:text="@string/cert2" android:gravity="center" android:paddingbottom="100dp" android:onclick="btnclicklistener2 "/> <textview android:id="@+id/dipcert3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textsize="30dp" android:text="@string/cert3" android:gravity="center" android:layout_centervertical="true" android:layout_centerhorizontal="true" android:paddingbottom="10dp" android:onclick="btnclicklistener3"/> </relativelayout>
and when click aon each of them "btnclicklistener3" called.
all 3 textview
has same layout_width="fill_parent" , layout_height="fill_parent" in relativelayout
detect click on textview3.
use linearlayout
orientation="vertical".
and set layout_width="wrap_content" , layout_height="wrap_content" textview
.
also answered @aleksandrbel remove last space name of functions in textview 1 , 2.
Comments
Post a Comment