简体   繁体   中英

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.

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

在此处输入图片说明

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

Then you will not have the issue of text overflow.

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.

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