https://developer.android.google.cn/reference/android/view/View?hl=en#attr_android:textAlignment
API 17 时添加的属性,一直没用到过,记录一下这个简单的属性
android:textAlignment 支持以下属性值
| Constant | Value | Description |
|---|---|---|
| center | 4 | Center the paragraph, for example: ALIGN_CENTER. |
| gravity | 1 | Default for the root view. The gravity determines the alignment, ALIGN_NORMAL, ALIGN_CENTER, or |
| inherit | 0 | Default. |
| textEnd | 3 | Align to the end of the paragraph, for example: ALIGN_OPPOSITE. |
| textStart | 2 | Align to the start of the paragraph, for example: ALIGN_NORMAL. |
| viewEnd | 6 | Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved layoutDirection is LTR, and ALIGN_LEFT otherwise. |
| viewStart | 5 | Align to the start of the view, which is ALIGN_LEFT if the view’s resolved layoutDirection is LTR, and ALIGN_RIGHT otherwise. |
textEnd与viewEnd 的不同,正如上述英文描述的一样,layoutDirection 不一样的时候有所不同
下面展示在设置了 android:textDirection="rtl" 的文字显示效果
android:textAlignment="viewEnd"
android:textDirection="rtl

android:textAlignment="textEnd"
android:textDirection="rtl"

最后
以上就是听话铅笔最近收集整理的关于android:textAlignment 属性的全部内容,更多相关android:textAlignment内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复