how to obtain the default font size

by guich » Wed, 16 Mar 2011 01:39:54 GMT


Sponsored Links
 Hi,

I searched the topics and tried some things, but could not achieve
what i need.

I want to obtain the font height in PIXELS used in the text "Silent
mode" of the "Sound & display" option of the Settings application.

In this screen i see lots of font sizes, but i want the biggest size.
I assume that this is the standard size of the font for the device.

Actually, if i could find any "default font size" in pixels i could
compute the other sizes.

What i have is:

1. A class that extends SurfaceView
1.1 A Bitmap that's drawn with my app contents
1.2 A SurfaceHolder
2. A class that extends Activity

I assumed that i could get the info with some structure at the
surfaceChanged, but i checked all methods of all classes and could not
find anything useful.

TIA,

     guich

-- 



Re: how to obtain the default font size

by Brill Pappin » Wed, 16 Mar 2011 03:36:36 GMT


 I'm interested in what responses you get.

I attempted to use text sizes indicated by the OS in one of my keyboards, 
but it turns out that some phones don't report it properly or have a very 
different idea of what the size means than others do. For me the result was 
that on some phones the text would be very tiny.
So far I have not discovered a really reliable way to set a text size.

- Brill Pappin

-- 


Sponsored Links


Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 21:05:28 GMT


 Its really a shame that this can't be done. I never found a solution,
in any other threads. Boy, i miss Windows Mobile, with their
SystemMetrics api.

guich

-- 



Re: Re: how to obtain the default font size

by Pepijn Van Eeckhoudt » Wed, 16 Mar 2011 21:27:46 GMT


 

Its really a shame that this can't be done. I never found a solution, in any other threads. Boy, i miss Windows Mobile, with their SystemMetrics api.
Have you tried reuse the correct style/theme ( http://developer.android.com/guide/topics/ui/themes.html )? Bit of a kludge, but you could also try creating an instance of the corresponding View and asking that for its text size. (e.g., new TextView().getTextSize()) Pepijn --



Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 22:06:07 GMT


 Pepijn,

Many thanks. That simple line solved the issue.

Got the following results:

Htc Magic: 14
Motorola Spice: 11
Motorola Milestone: 21

So, from this i can achieve the results i need.

All the best

    guich

-- 



Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 22:07:39 GMT


 Many thanks, it worked!

-- 



Other Threads

1. How to test if app is shown on Market for all screensizes

As if it's not enough to have to manage the manifest, but HTC has a bit of a
habit of releasing phones that cannot see some apps. Examples include the
HTC Hero when it was released in Europe, and the HTC Eris recently released
in the USA.

I'd like to know if those phones you mention can see our app (PhoneMyPC) as
well. Anybody have an idea how to check that?

Scott
SoftwareForMe.com
Makers of PhoneMyPC








> 

2. Map Application works in 1.5 but not working in 2.0

Yeah, I realize that.  However, according to Google...

        <!--
        If your application absolutely need maps, you could add the
        <uses-library> tag (even though you don't use the Maps API). This
will
        make sure your app only install on devices with Maps.
        -->
        <uses-library android:name="com.google.android.maps"/>

Peace,
Scott






-- 

3. Given a TextView of a specific height, how many lines of text can be displayed?

4. Why Broadcast receiver can't receive UMS_CONNECTED, UMS_DISCONNECTED msg dynamically in activity ?

5. "On Android nobody is making s ignificant revenue.鈥???

6. Has anyone got SEQUENCE_INVARIANT to work with a GestureLibrary?

7. How to Build a Framework Library(JAR) and Use it in Eclipse.