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

后端 未结 5 978
走了就别回头了
走了就别回头了 2020-12-30 18:17

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         


        
5条回答
  •  不思量自难忘°
    2020-12-30 18:46

    layout_gravity means that you are specifying the layouts attribute, not the element inside. In some conditions, such as layout_width and layout_height is wrap_content, layout specifications can give what you want about the element inisde your layout, since the boundries of the layout and the element (not elements) are the same..

提交回复
热议问题