简体   繁体   English

Textview溢出屏幕

[英]textview overflowing out of the screen

i have this problem where i create ax number of textview in my layout to store 1 character in each text view. 我有一个问题,我在布局中创建了一个文本视图,以在每个文本视图中存储1个字符。

however when the text gets too long, the text would not go to the next line and it will get overflowed out of the screen 但是,当文本过长时,文本将不会转到下一行,并且会溢出屏幕。

is there anyway for me to keep the textviews in 1 screen? 反正我有将textviews保留在一个屏幕中吗?

 LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        TextView[] tv = new TextView[counter];
        float textSize = 65;

        for (int i = 0; i < counter; i++)
        {
                tv[i] = new TextView(this);
                tv[i].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
                tv[i].setTextSize(textSize);
                tv[i].setText(""+singleText[i]);
                linearLayout.addView(tv[i]); 
        }
        setContentView(linearLayout);

在此处输入图片说明

I think you should try using this TextView.setSingleLine(false) 我认为您应该尝试使用此TextView.setSingleLine(false)

Then you will not have the issue of text overflow. 这样就不会出现文本溢出的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM