Sunday, March 18, 2018

Widget preview image

Leave a Comment

My app preview image looks like this: enter image description here

How can I make it look like the WhatsApp Chat preview, small with shadow. Also other apps in my phone use the same type of preview.

My widget xml:

<?xml version="1.0" encoding="utf-8"?> <appwidget-provider     xmlns:android="http://schemas.android.com/apk/res/android"     android:initialLayout="@layout/appwidget"     android:minHeight="40dp"     android:minWidth="320dp"     android:previewImage="@mipmap/ic_launcher"     android:updatePeriodMillis="300000" > </appwidget-provider> 

Manifest:

<receiver             android:name=".activities.MyWidgetProvider"             android:label="Example Widget">             <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> 

2 Answers

Answers 1

You have set your launcher icon as widget preview image.

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"   ...   android:previewImage="@drawable/widget_preview"> </appwidget-provider> 

I suggest you to make a screenshot of your widget with the emulator, which has an application (Widget Preview) for creating a preview with just the right size.

Then, you can also edit the picture if you are not satisfied.

Anyway, be sure to put it on drawable-nodpi.

Official guide to follow: https://developer.android.com/guide/topics/appwidgets/index.html#preview For other dev experience, see this link: Android Widget: previewImage size

Answers 2

It seems that you have placed ic_launcher as widget previewImage

  • You have to make a custom image, which have large image as Alpha in background, and on it place your icon in small size on top-right corner.

I have done same thing by generating custom image for previewImage with help of photoshop and its working.

Thank you.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment