I’m having a lot of trouble finding references for lockscreen widgets that were introduced in Android 4.2.
I’ve created a widget that works fine on the launcher and it is sized as I expect. However I’ve enabled this widget to be on the lockscreen and it doesn’t size properly, vertically.
According to http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen it will take up the size available vertically if you set android:resizeMode="vertical"
If the widget marks itself as vertically resizable, then the widget
height shows up as “small” on portrait phones displaying an unlock UI.
In all other cases, the widget sizes to fill the available height.
Also I used the sizing described at http://developer.android.com/guide/practices/ui_guidelines/widget_design.html
Tiles > Size
- 1 > 40dp
- 2 > 110dp
- 3 > 180dp
- 4 > 250dp
- … > …
- n > 70 × n − 30
I’ve set this and at appears to be even smaller than a “small” widget. Basically, does anyone know what is wrong with the widget in image 1 that it won’t expand? My code is below.
1) What it looks like in its default state.

2) What it looks like when expanded on another screen.

xml/clock_widget.xml
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialKeyguardLayout="@layout/clock_widget"
android:initialLayout="@layout/clock_widget"
android:minHeight="110dp"
android:minWidth="180dp"
android:resizeMode="vertical"
android:updatePeriodMillis="1000"
android:widgetCategory="keyguard|home_screen" >
</appwidget-provider>
layout/clock_widget.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clock_widget"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="36sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=":"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="36sp" />
<TextView
android:id="@+id/widget_minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="36sp" />
</LinearLayout>
<TextView
android:id="@+id/widget_date"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Looks like this only happens in the emulator. Testing on real hardware works fine.