對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  的代碼

<TextView
        android:text="textAlignment Style"
        android:background="#aaff0000"
        android:textAlignment="textEnd"
        android:layout_width="300dp"
        android:layout_height="100dp"/>

效果:

center


textEnd、viewEnd、


inherit、gravity、textStart、viewStart



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章