Centering text in a button?

by CyberQat » Wed, 11 Nov 2009 03:42:30 GMT


Sponsored Links
 Hi Guys,

Ive just started fooling around with programming my Motorola Droid.
I'm programmatic ally laying out an interface such that the text
contained in my Button is sized at layout time to fit the button.  My
questions are:

(1) I know the pixel size of the button, what is the best way to set
the text size to fit the button size?
(2) I can't seem to get it to center.  I've tried a Gravity of 11 and
that helps, but ist still not right.  How do I get my text to center
itself properly horizontally and vertically in the button?

Thanks

--



Centering text in a button?

by CyberQat » Thu, 12 Nov 2009 14:19:22 GMT


 Some more info

The text is perfectly centered (but tiny) if I lave it at the default
setting.  If I try to scale it
up to match the button size however I lose vertical centering :(

Ive tried looking at the drawing code but it is massively complex.

Anyone know a soln?




--


Sponsored Links


Other Threads

1. High Level Wrapper for SQL-Lite

Hello All,
I am developing an Android Application for which i would be using a
high level SQL-Lite Wrapper. Can anyone suggest me a high level
wrapper for SQL Lite
Thanks a lot
Pali Gill.

-- 

2. MOHON BANTUAN [Nexus One

Saya sudah 2 minggu pakai Nexus One, masih standar dan belum diroot kecuali 
hanya install program gratis via Android Market ....

Dari Bengkulu, sekarang saya di Jakarta, adakah diantara rekan-rekan yang mau 
membantu saya secara langsung, agar saya Nexus One saya optimal ? Saya akan 
datang, tks

Mohon bantuan .....


Radja Herawan Onyx : 215A943C
Radja Herawan Odyn : 30FF13A5
Nexus One The Android # 1
The WranglerBerry B 16 TR - YB4MF
http://www.herawansyah.blogspot.com

-- 
"Indonesian Android Community [id-android]" 

3. Samsung Galaxy Spica tidak ada fungsi getar/vibrate?

4. Camera question

5. How to detect when android kill my process?

6. Getting a resource id from an xml file

7. Start My Next Activity