小部件预览图 [英] Widget preview image

查看:85
本文介绍了小部件预览图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用预览图像如下所示:

My app preview image looks like this:

如何使它看起来像WhatsApp聊天预览,带有阴影.手机中的其他应用程序也使用相同类型的预览.

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.

我的小部件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>

清单:

<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>

更新:

实际上,我注意到了所有这些快捷方式,而不是小部件,它们都具有这种外观.

Actually I have noticed this all shortcuts and not widgets, they all have this look.

推荐答案

您已将启动器图标设置为小部件预览图像.

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.

无论如何,请务必将其放在 drawable-nodpi 上.

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

要遵循的官方指南: https://developer.android.com/guide/topics/appwidgets/index.html#preview 有关其他开发人员的经验,请参见以下链接: Android窗口小部件:previewImage大小

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

这篇关于小部件预览图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆