Issue
I want to use a text as a button in Android. Suppose I have one text like 'Register'. I want to use this text as a button means when i will click in the text, it will open the Registration Screen. I am using XML for developing the UI and i am doing it for Android Tablet Application.
Thanks in advance
Solution
Set the following property in the xml of TextView:
android:background="#dadada"
android:clickable="true"
Now in the java src file recieve this TextView and set OnClickListener.
TextView tv=(TextView)findViewById(R.id.text);
tv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//perform your action here
}
});
Answered By - Dinesh Sharma
Answer Checked By - Mildred Charles (JavaFixing Admin)