0

Below is the view stub that I am trying to use in the widget layout for app widgets.

<ViewStub
android:id="@+id/test_viewstub"
android:layout_width="50dp"
android:layout_height="30dp"
android:inflatedId="@+id/test_viewstub"
android:layout_alignParentTop="true"
android:layout="@layout/test_viewstub"/>

The issue is that when I add this to the widget layout the widget UI is lost and 'Problem loading widget' message is displayed in the place of widget.

But when I use the same view stub as it is in an activity layout then its working perfectly fine.

Any suggestions or help on this issue.

Thanks In Advance

amj
  • 367
  • 1
  • 8
  • 26
  • Is there any error message logged in logcat too? What does the content of `@layout/test_viewstub` look like? Also can you show the code related to interacting with the `ViewStub` through the `RemoteViews` instance? In order for the optional view hierarchy represented by the `ViewStub` to become available, you'll have to change its visibility first. – MH. Apr 23 '15 at 09:32
  • RemoteViews also supports ViewStub, which is an invisible, zero-sized View you can use to lazily inflate layout resources at runtime. – Jain Nidhi Apr 23 '15 at 09:40
  • @MH. I don't see any log related to the widget, and the layout just has a textview, Im not doing much with the view stub in the code currently just to test this issue. And to make the view stub visible, I am just calling the setVisibilty of the viewstub to visible. And the same view stub works in the widget in phone. – amj Apr 23 '15 at 10:20
  • any solution to this problem ? I have almost same issue. – Walid Aug 03 '18 at 14:40

0 Answers0