how to give Edittext and button to half of the screen width?
posted 3 years ago
below is my login screen.I need to give both EditText and Button to take half of the screen width.can we archive this using weight ?unless i have to give margin values specifically for each type of screens(small,large,...)?
Weights only work with LinearLayout. For a perfect 50/50 split in a RelativeLayout you can put a view centered in the layout, then put your views to the left and right of the strut. Something like this:
You can adjust the spacing more or less than 50/50 by putting a left margin on the space. Example: