Android_RelativeLayout - How to put two elements on the same line?

前端 未结 5 1938
遇见更好的自我
遇见更好的自我 2021-01-25 05:32

The question is: I have a TextView and an EditText, how can I place them on the same \"level\"?

http://postimage.org/image/o9l17a3zv/

As you can see, I want to p

5条回答
  •  借酒劲吻你
    2021-01-25 06:03

    You have to center your text in the TextView widget for that just use the android attribute android:gravity in your TextView xml declaration.

    If you want Your text to get centered vertically and horizontally use:

     android:gravity="center"
    

    If you want Your text to get centered only horizontally use:

     android:gravity="center_horizontal"
    

提交回复
热议问题