简体   繁体   中英

Text align in android editext

I have the following component in my main.xml

<EditText android:id="@+id/result"  
        android:singleLine="true"   
        android:layout_span="3"  
        android:text="0.0" />  

How do i align the text to the right , as it is aligned to the left by default.

android:gravity="right"到EditText

android:layout_width="match_parent"
android:gravity="end"

Add these two properties to your EditText.

在标签下方添加

  android:gravity="right"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM