How to right-align text in an Android TextView or EditText?

You may use android:layout_alignParentRight="true" to align the EditText's right edge to its parent's right edge. Also, if you really want to use the layout_gravity or gravity attributes, check out this article that discusses the proper use of them.


You can jst set property for edit text in property window i.e. Gravity to right or by adding code of lin e in xml file of UI : android:gravity="right"


You should use android:gravity="right". layout_gravity is for the view (EditText) alignment against the container.