Move two side by side textviews to be one under another if text is too long

前端 未结 3 1849
余生分开走
余生分开走 2021-01-14 07:36

I have two textviews like this:

=======================
= TextView1 TextView2 =
=======================

And I would like to detect when the

3条回答
  •  太阳男子
    2021-01-14 08:39

    You should use a single, multi-line TextView and set the text as follows :

    mTextView.setText(text1+" "+text2);
    

    or

    mTextView.setText(text1+"\n"+text2);
    

    depending on your particular needs.

    EDIT: you could specify your text in html, and then use Html.fromHtml(htmlString) and display this text in your TextView.

     String text1 ="This is some text!"
     String text2="This is some other text!"
     textView.setText(Html.fromHtml(text1+ "
    "+ text2);

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题