开发者

How to align TextView in android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜