在Android的TextView中右对齐文本 [英] Right align text in android TextView

查看:144
本文介绍了在Android的TextView中右对齐文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个的TextView 在我的应用程序。我想对齐到右侧的文本。我尝试添加

I have a TextView in my application. I want to align the text in it to the right. I tried adding

android:gravity="right"

但是,这并不为我工作。任何其他建议?

but this doesn't work for me. any other suggestions ?

推荐答案

我认为你这样做是:机器人:layout_width = WRAP_CONTENT 。 如果是这样的情况下做到这一点:机器人:layout_width =match_parent

I think that you are doing this : android:layout_width = wrap_content . if this is the case do this : android:layout_width = "match_parent"

这篇关于在Android的TextView中右对齐文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆