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. app2sd is working on nexDesire!

yes!

makasih semua.......

sekali lagi, makasih pisan....*terharu baru*

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

2. Memory leak in shared library - any way to find out

Hi Digambar,

I have posted the following reply on a similar query yesterday to the
"Android Linux Kernel Development" group:

I do not know how relevant it is for you but there are alternative
"emulators" out there that can be customized by the user to e.g. track
memory allocation and perform other debug tasks. I am specifically
talking about so called "Virtual Platforms" which provide scripting
APIs that allow the software developer create creative user defined
traces. As an example: A breakpoint is set on malloc and free in
libc.so. The breakpoint will not stop the simulation but trigger a
callback script that is executed in the Virtual Platform debug
environment (not in the software, the software will not even recognize
it). The script will then e.g. get the allocation size and address and
track the allocation in a process. This specific topic is discussed
here:

http://groups.google.de/group/virtual-platform-users/browse_thread/thread/73ceb6868c0cfbc5
http://virtual-platform-users.googlegroups.com/web/android_process_heap_analyze.png

There is a free online version of a Virtual platform (Realview
baseboard for ARM9 accessible in this group (located in a cloud) that
boots Android 2.0 and which can be used to try out things.

As said, I do not know if this solution may apply to your work but I
wanted to let you know.

Best regards,
Achim

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Say goodbye to blapk market

4. New Birthday Calendar

5. eBuddy, tanya

6. Fring

7. Regarding on key left