How to make 4x1 size widget on Android homescreen?

前端 未结 2 1762
名媛妹妹
名媛妹妹 2020-12-14 20:15

I have difficulties developing 4x1 widget for Android.

This is the appprovider

 

        
相关标签:
2条回答
  • 2020-12-14 20:46

    In ICS it must be showing 4x2.

    To correct this make a folder in 'res' name 'xml-v14':

    Define your widget appwidget-provider with same xml name here. just change minHeight to 40dp. This will correct the error.

    Hope this help you.

    0 讨论(0)
  • 2020-12-14 20:47

    I don't think it's a newbie mistake.. I've had an appWidget that was 1x1 cell in size. I set it to 72dp x 72dp, and it was working fine.. But it seems like Google changed the widget dimension sizing formula from

    (cells * 74) - 2
    

    to

    (cells * 70) - 30
    

    So now the default size of my widget has to be 40dp x 40dp..

    Source: http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#anatomy_determining_size

    0 讨论(0)
提交回复
热议问题