我想给我的Widget一个渐变背景。为此,我使用了以下xml作为渐变:
<?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>
并在我的布局中添加:
<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>
如果我在我的应用程序中使用此布局,它会显示,但在我的窗口小部件上,我只得到一个白色屏幕。我错过了什么吗?是不是可以在RemoteViews中提供xml渐变?
答案 0 :(得分:2)
它可能只是清洁&amp;建立你的项目&amp;然后检查它应该工作:)