How to correctly set a big widget icon in android

android, android-appwidget, android-widget, widget

Solution

Try using this.

android:previewImage="@drawable/widget_4bg"

sample xml widget_info

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:initialLayout="@layout/your_widget_layout"
    android:minHeight="400dip"
    android:minResizeHeight="250dip"
    android:minResizeWidth="300dip"
    android:minWidth="450dip"
    android:previewImage="@drawable/widget_preview"
    android:resizeMode="horizontal|vertical"
    android:updatePeriodMillis="172800000" >

</appwidget-provider>

Update

 <receiver
            android:name="com..widget.WidgetProvider"
            >
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />

            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widget_info" />
        </receiver>

Problem

This is my question: My program have 2 widgets. One of them is 4x1 cells size. This widget has an icon(has the same width as widget itself) set in manifest file ``` android:icon="@drawable/widget_4bg" ``` My problem is that on android OS 4.x mobiles in the widget list, the icon is not spread on entire 4 cells but only in one. How can I set correctly icon programmatically?

Original source