2017-03-25 24 views
1

私のTextViewのテキストを右に整列させ、ビュー内で垂直にセンタリングしようとしています。私は重力とtextAligment属性の異なる組み合わせを試しましたが、私はテキストを垂直方向の中心に置くことができただけで、まだビューの左側に揃っています。テキストを右と中央に縦に整列させ、xamarin android textview

<TextView 
     android:id="@+id/textViewInput" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="0.3846" 
     android:textAlignment="viewEnd" 
     android:gravity="center_vertical" 
     android:background="#cfd8dc"  
     android:textColor="#000000"/> 

答えて

6
は、あなたの gravity center_vertical|rightに変更し、 textAlignmentタグ削除

<TextView 
    android:text="stackoverflow" 
    android:id="@+id/textViewInput" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="0.3846" 
    android:gravity="center_vertical|right" 
    android:background="#cfd8dc" 
    android:textColor="#000000"/> 
関連する問題