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. Time Conversion - CST to LST(Local Standard Time)

Hi,
     If the input is in CST, it should get converted according to a
particular local time.
For Example, Being in india should be converted for IST, Being in USA
should get converted for united states standard time....
Can u Plz help in this?

-- 

2. NDEF intent filters

I have defined an intent-filter for NDEF formatted tags as follows

   <intent-filter>
      <action android:name="android.nfc.action.NDEF_DISCOVERED" />
      <data android:mimeType="text/*" />
   </intent-filter>

With the data field, a mime-type can be specified.

Is it also possible to add additional data to an NDEF intent filter
for NDEF tags which are not of type TNF_MIME_MEDIA? For example for
NDEF tags with a "well-known" type name format, i.e. a NDEF tag of
type TNF_WELL_KNOWN?

Or for NDEF tags of type TNF_EXTERNAL_TYPE (i.e. NFC Forum external
type tags)? Here tye type has fhe form urn:nfc:ext:company.com:app (or
company.com:app for short)

- Dominik

-- 

3. MyTouch 4G & iPhone 4 32GB

4. Help writing a sample Android App

5. jualan non android di sini

6. Assets in the assets folder

7. Error when adding Action Bar ["No resource identifier found for attribute 'showAsAction' in package 'android'"]