• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

How to automatically add horizontal space between items in ListView?

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Referring to the img I posted above, everything in there are EditText that user input except "$" is a TextView and "large" is a selected spinner item. Now, I'm having difficulty to figure out how to automatically spaced "$" and the price, and also between quantity and unit (large). Here is my xml

Since I don't know how long the price that user input will be (it could be 1.80 or it could also be 9999999999.99 lol) so the solution that I can think of is to add paddingEnd and marginEnd but that leaves too much space between the items and I don't like how it looks. So, is there a way to automatically space between the two text so no matter what the price that user input, the space between $ and price; and quantity and unit will be the same? Sorry if I don't explain myself well.

Also, why does 0 at the end of the price not displayed? The price displayed two decimal points if the price, for example, 3.89. but when the price has 0 at the end (i.e. 3.80), the 0 not displayed?

Thank you.
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic