Hacker News new | ask | show | jobs
by Dove 5122 days ago
android:background="#ffee11" on the button?

That . . . actually works! Well, now I'm embarrassed. I had previously had to go this route http://www.androidworks.com/changing-the-android-edittext-ui... with text fields, and assumed it was the only way.

How do you get buttons to occupy a percentage of the screen (I hesitate to ask, as it's probably something similarly trivial . . . but it's been such a painful subject for me that I really want to know!)?

1 comments

How do you get buttons to occupy a percentage of the screen

In a LinearLayout take a look at layout_weight -- it is the key (or rather, one of the keys) to goodness. It really is an onion, and if you can get through the crying the flexibility comes in the layers.

Oh dear! That's really not the answer I was hoping for. That's about where I gave up last time -- somewhere around a dozen nested vertical and horizontal linear layouts with various weights, gravities and alignments that still wasn't giving me quite what I wanted.

Still, for correcting me on the button background thing alone, I suspect you've added years to my life. Dunno what the online equivalent of buying you a drink is, but . . . thank you.