我是靠谱客的博主 勤奋芒果,最近开发中收集的这篇文章主要介绍android:textalignment 参数解释,Text/Layout Alignment in Android (textAlignment, gravity),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

问题

What's the difference between android:textAlignment and android:gravity?

回答1:

All I can see is that the textAlignment is a member of the View Class and the gravity is the member of TextView class. So for the TextView and its subclasses you can use the gravity while you can use the textAlignment for all Views.

As the TextView and its subclasses need some more text-aligning features, so you can see there are more options in gravity where in textAlignment there are only basic options. Although it is only my guess because I have not found any clear documentation about the difference.

You can see these two links of documentation: textAlignment and gravity.

回答2:

With API 15, android:textAlignment may not have the desired result. The snippet below attempts to centre the first TextView object using android:textAlignment="center". The second uses android:gravity="center_h

最后

以上就是勤奋芒果为你收集整理的android:textalignment 参数解释,Text/Layout Alignment in Android (textAlignment, gravity)的全部内容,希望文章能够帮你解决android:textalignment 参数解释,Text/Layout Alignment in Android (textAlignment, gravity)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部