[英]How to align TextView in android
我正在动态添加Linearlayout
并添加3 TextView
从webservices
获取文本视图的内容,如果3文本大小的内容较大,它将显示在下一行的末尾。我想在起始行中显示怎么办?
谢谢
在特定的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");
TextView header_text;
header_text = (TextView) findViewById(R.id.header_text1);
header_text.setSingleLine();
尝试使用android:gravity =“ left”或alignParent =“ left”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.