Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

how to give Edittext and button to half of the screen width?  RSS feed

 
Ranch Hand
Posts: 1292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,...)?

 
Bartender
Posts: 4179
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
sam liya
Ranch Hand
Posts: 1292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!