Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Widget: previewImage size

Tags:

android

widget

I have a widget in Android for which I am setting a previewImage. Unfortunately, I am having issues figuring the good size for the widget: if it's too big, it gets cropped at the bottom of the frame.

I have been trying to find the recommended size, or even better, the pixel dimensions of this frame where the preview image gets displayed, but I cannot find it in the documentation.

Does anyone please know where to look for that information please?

Thank you.

like image 672
user1777907 Avatar asked Nov 26 '12 23:11

user1777907


2 Answers

The emulator has an application for creating a preview with just the right size:

http://developer.android.com/guide/topics/appwidgets/index.html#preview

My suggestion would be to grab a previewImage of your widget with that application and then look at the size.

like image 185
Nick Palmer Avatar answered Sep 22 '22 11:09

Nick Palmer


According my tests widget preview is connected to widget XML file.

widget preview for widget 1x1:

picture size: width=138pixels, height=138pixels

xml file definition: android:minHeight="50dp", android:minWidth="50dp"

widget preview for widget 2x1:

picture size: width=236pixels, height=138pixels

xml file definition: android:minHeight="50dp", android:minWidth="120dp"

like image 28
Michal Avatar answered Sep 18 '22 11:09

Michal