Why can't I set text to an Android TextView?

前端 未结 8 2040
孤城傲影
孤城傲影 2020-12-31 03:04

I\'m having a problem with setting text to a TextView:

TextView android:editable = \"true\".

In my .java it seems like that this should wor

8条回答
  •  被撕碎了的回忆
    2020-12-31 03:25

    In your XML, you had used Textview, But in Java Code you had used EditText instead of TextView. If you change it into TextView you can set Text to to your TextView Object.

    text = (TextView) findViewById(R.id.this_is_the_id_of_textview);
    text.setText("TEST");
    

    hope it will work.

提交回复
热议问题