Appwidget size calculation

后端 未结 4 729
说谎
说谎 2020-12-12 17:34

It might be me, but when I calculate minimum app widget sizes according to the formula given on the android page I don\'t get the right widget widths; The formula is as foll

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 18:16

    In my 4x1 widget, I used these dimensions for res/values/dimens.xml:

    
    0dp
    294dp
    72dp
    

    and for res/values-v14/dimens.xml:

    
    0dp
    250dp
    40dp
    

    I used widget templates pack for background images .

    In official guide there is written that default margin in res/values/dimens.xml should be 8dp, but if I use 8dp, my widget is smaller than standard widgets on the desktop (google search, weather etc.). Thats's because margin for v1-v13 is built in the background image:

    enter image description here

    I tested it on HTC Desire, Nexus S, emulator Android 2.2 and emulator Android 2.3.3. With the templates pack backgrounds and configuration above, my widget's size is the same as other standard widgets and looks good on all devices I tested.

    There is also problem with various launchers. I recommend this article to read: http://radleymarx.com/blog/app-widget-padding-margins-in-ics-android/

提交回复
热议问题