开发者

How to align TextView in android

开发者 https://www.devze.com 2023-01-21 20:26 出处:网络
I am adding Linearlayout dynamically and adding 3 TextView getting the content from webservices for text view if the content of 3 text size is larger it will display in the end of next line .i 开发者_

I am adding Linearlayout dynamically and adding 3 TextView getting the content from webservices for text view if the content of 3 text size is larger it will display in the end of next line .i 开发者_JS百科want display in start line how can i do?

Thanks


TextView   header_text;
header_text = (TextView) findViewById(R.id.header_text1);   
header_text.setSingleLine();


try to use android:gravity="left" or alignParent="left"


To align your Text inside a specific TextView:

    Textview t = (Textview) findViewbyid(R.id.yourView); //refernce to your View
    t.setGravity(Gravity.RIGHT); //or any align you want
    t.setText("String text or long string");
0

精彩评论

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