Search code examples
androidwidgetgradientremoteview

xml Shape-Gradient doesn't show on my Widget


I want to give my Widget a gradient background. For this, I used following xml for the gradient:

<?xml version="1.0" encoding="utf-8"?>
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle">
    <gradient 
        android:startColor="@color/general_listrow_background_start"
        android:endColor="@color/general_listrow_background_end"
        android:angle="270"/>    
</shape>

and add this inside my Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget_main_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_margin="@dimen/widget_margin"
    android:padding="@dimen/widget_padding"
    android:orientation="vertical"
    android:background="@drawable/background_gradient">
    ....
</LinearLayout>

If I use this Layout inside my Application, it shows up, but on my Widget I get only a white screen. Do I miss something? Isn't it possible to give xml gradients inside RemoteViews?


Solution

  • it is possible just clean & build your project & then check it should work :)