How can i make textview Clickable false ? I tried with textView.setClickable(false)
but it is not working i add my snippet below.
t1 = (TextView)findViewById(R.id.text_View1);
t1.setClickable(false);
//t1.setFocusableInTouchMode(false);
//t1.setEnabled(false);
t1.setFocusable(false);
t1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
t1.setText("clicked");
}
});
But when i click on textview text is change kindly help me.
您需要完全禁用TextView:
t1.setEnabled(false);
try to change the listener position like this
t1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
t1.setText("clicked");
}
});
t1.setClickable(false);
//t1.setFocusableInTouchMode(false);
//t1.setEnabled(false);
t1.setFocusable(false);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.