Share

Metawidget

Subscribe

android styles

  1. 2009-11-03 19:34:06 UTC

    Hello again. Trying to put the styles into android app.

    I've set the labelStyle and sectionStyle to my style. However

    A) widget captures the color, but not the size of font (android:textSize property)

    B) how to set the style for the attribute textviews when they are shown in a readOnly way?

  2. 2009-11-03 19:59:44 UTC

    also e.g.

        <item name="android:gravity">right|center_vertical</item>
    

    isn't handled. I didn't check more attributes.

  3. 2009-11-03 21:50:49 UTC

    Kretes,

    Yes. Google seem to have broken this support between 1.0 R1 and 1.0 R2. I'd love to know how to fix it. I have tried asking Google here...

    http://groups.google.com/group/android-developers/browsethread/thread/3fabdf2abe6daa56/32aec49be2b4ad5f?showdocid=32aec49be2b4ad5f

    ...but it's not clear how to apply styles programmatically. Hopefully this has been fixed in 1.5/1.6/2.0, which I am about to migrate to.

    Your help would be very much appreciated. Is it possible nowadays to create a View programmatically and apply styles programmatically?

    Regards,

    Richard.

  4. 2009-11-03 21:54:14 UTC

    P.S. If you'd like to help, the method that needs reworking is org.metawidget.android.AndroidUtils.applyStyle().

    It takes a View to style, and a resource id of a style from styles.xml (eg. R.section) and needs to work through the styles and apply them. I would think this support would be exposed in the Android API. It very nearly is, but there were annoying dependencies on XmlPullParser. See...

    http://markmail.org/message/ogskv4frewsxghlp#query:+page:1+mid:ogskv4frewsxghlp+state:results

    I'd love your help!

    Regards,

    Richard.

  5. 2009-11-08 16:37:08 UTC

    I couldn't find the desired way to apply the style.

    However I'm going to add the 'gravity' and 'textColor' support in the method You pointed.

  6. 2009-11-08 19:08:35 UTC

    Wanted to add gravity and textsize, not color, because color is ok.

    however - found out You have code for setting text size, but it's not working. - looks like something on android site.

    However I finally managed to fix it - the obtainAttributeValues should be called for a textSize apart.

    I can publish the solution this week, so You can take a look and maybe merge with MW.

  7. 2009-11-08 21:54:49 UTC

    Kretes,

    Yes, I would love improvements in org.metawidget.android.AndroidUtils.applyStyle. Please publish your changes and I'll see about incorporating them (with due credit, of course).

    Many thanks,

    Richard.

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.