hayk Member Feb 7, 2024 #1 Hi B4X community! Does anyone knows, how to set an image for the created widget to be displayed in widget select page like in attached image? Also, see the B4A widget display. How to set an image for widget? Thanks in advance. Attachments widget select image.jpg 92.7 KB · Views: 433 example.jpg 102 KB · Views: 390
Hi B4X community! Does anyone knows, how to set an image for the created widget to be displayed in widget select page like in attached image? Also, see the B4A widget display. How to set an image for widget? Thanks in advance.
Erel B4X founder Staff member Licensed User Longtime User Feb 8, 2024 #2 A file named Objects\res\xml\widgetservice_info.xml is generated during compilation. You can edit it and make it readonly. You need to add previewImage and previewLayout attributes: https://developer.android.com/develop/ui/views/appwidgets Upvote 0
A file named Objects\res\xml\widgetservice_info.xml is generated during compilation. You can edit it and make it readonly. You need to add previewImage and previewLayout attributes: https://developer.android.com/develop/ui/views/appwidgets
hayk Member Feb 8, 2024 #3 SOLVED! Thanks for your reply . Your guidance helped me a lot. So in Objects\res\xml\widgetservice_info.xml file I've added following line: Code: Copy android:previewLayout="@layout/widgetreceiver_layout" android:previewImage = "@layout/preview_image" /> where: @layout stands for file directory, widgetreceiver_layout is an widget XML file located at layout directory, previewImage is the name of JPG file witch I stored in layout folder. Stored preview image must be set Read Only otherwise compiler might delete it. Also do not write preview image file extension , only use file name as shown in code section. "previewImage" is the name of the jpeg file witch will be displayed in widget preview page. Attachments preview_image.jpg 40.9 KB · Views: 359 Widget preview page.jpg 96.9 KB · Views: 317 Last edited: Feb 8, 2024 Upvote 0
SOLVED! Thanks for your reply . Your guidance helped me a lot. So in Objects\res\xml\widgetservice_info.xml file I've added following line: Code: Copy android:previewLayout="@layout/widgetreceiver_layout" android:previewImage = "@layout/preview_image" /> where: @layout stands for file directory, widgetreceiver_layout is an widget XML file located at layout directory, previewImage is the name of JPG file witch I stored in layout folder. Stored preview image must be set Read Only otherwise compiler might delete it. Also do not write preview image file extension , only use file name as shown in code section. "previewImage" is the name of the jpeg file witch will be displayed in widget preview page.