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?
You can customize your widget's height and width by tapping and holding your finger on the widget to bring up the widget resize mode.
You can import and create your own custom widgets for the Android platform. Quantum Visualizerplatform has defined a contract that any custom widget should implement.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With