开发者

textview overflowing out of the screen

开发者 https://www.devze.com 2023-02-13 16:21 出处:网络
i have this problem where i create a x 开发者_StackOverflownumber of textview in my layout to store 1 character in each text view.

i have this problem where i create a x 开发者_StackOverflownumber of textview in my layout to store 1 character in each text view.

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?

 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);

textview overflowing out of the screen


I think you should try using this TextView.setSingleLine(false)

Then you will not have the issue of text overflow.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号