简体   繁体   中英

How I set all line in textview have same length of character?

How I set all line in textview have same length of character?

This is text in sqlite database

在此处输入图片说明

This is textview in android

在此处输入图片说明

my query code in main.class

db.open(); Cursor c = db.getdescIntro(department,degree);

    if (c.moveToFirst())
    {

        do {
            a  = (String)c.getString(0);                
            txt.setText(a);

            PDF = c.getString(2);
        } while (c.moveToNext());
    }
    db.close();

My database.class

public Cursor getdescIntro(String dep,String degree) {

return db.query("academic", new String[] {"desc","department","acapdf"},"department" + "=?" +" AND " + "degree" +"=?", new String[] {dep,degree}, null, null, null);

}

If I understand your question right based on your screen shots, you're asking how to remove line breaks:

String myNewString = myString.replaceAll("\\n", "");

If you're looking for a solution to have the text fit exactly with the TextView's bounds, see this SO answer: auto-scale-textview-text-to-fit-within-bounds

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