本文介紹了如何在 Android TextView 或 EditText 中右對齊文本?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我的應用程序中有一個 EditText.我想將其中的文本右對齊而不是默認的左對齊.我嘗試添加
I have an EditText in my application. I want to align the text in it to the right instead of the default left. I tried adding
android:layout_gravity="right"
但這似乎不起作用.請問還有什么建議嗎?
but this doesn't seem to work. any other suggestions please?
推薦答案
你應該使用 android:gravity="right"
.layout_gravity
用于視圖(EditText)與容器對齊.
You should use android:gravity="right"
. layout_gravity
is for the view (EditText) alignment against the container.
這篇關于如何在 Android TextView 或 EditText 中右對齊文本?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!