对android:textAlignmentStyle 属性参数的理解

Constant Value Description
inherit 0 Default
gravity 1 Default for the root view. The gravity determines the alignment, ALIGN_NORMAL, ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction
textStart 2 Align to the start of the paragraph, e.g. ALIGN_NORMAL.
textEnd 3 Align to the end of the paragraph, e.g. ALIGN_OPPOSITE.
center 4 Center the paragraph, e.g. ALIGN_CENTER.
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.
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

1. TextView  的代码


效果:

center

对android:textAlignmentStyle 属性参数的理解_第1张图片

textEnd、viewEnd、

对android:textAlignmentStyle 属性参数的理解_第2张图片

inherit、gravity、textStart、viewStart

对android:textAlignmentStyle 属性参数的理解_第3张图片


你可能感兴趣的:(对android:textAlignmentStyle 属性参数的理解)