How to change the image displayed in the android widget selection dialogue?

喜欢而已 提交于 2019-12-07 07:23:35

问题


How do I change the rendering?


回答1:


Specify the android:previewImage attribute in your app widget XML metadata file:

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
  android:minWidth="146dip"
  android:minHeight="146dip"
  android:updatePeriodMillis="0"
  android:initialLayout="@layout/widget"
  android:autoAdvanceViewId="@+id/words"
  android:previewImage="@drawable/preview"
  android:resizeMode="vertical"
/>

(from this sample project)




回答2:


I had the same issue, tried everything deleted the old previewImage, uninstall/reinstall app, rebooting device, Sync Project with Gradle Files, Invalidate Caches/Restart, none worked. Finally, I could change it only after changing applicationId in build.gradle app file.



来源:https://stackoverflow.com/questions/27650435/how-to-change-the-image-displayed-in-the-android-widget-selection-dialogue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!