窗口小部件上的ScrollView发生错误

时间:2014-08-06 06:48:48

标签: android widget

当我使用scrollview for widget时,它不起作用.. 它说加载小部件就像问题一样.. 我不能在小部件上使用scrollview或者我使用滚动视图做错了吗? 这是我的代码..

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="3dp" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="sjfdiosjdfiosjdfoijsdfjisdjfosjdfiosjdfiosdjf
            sdjf
            jsdjfosijdfo
            sjdf
            jsd
            fs
            dfjsdfdfsdfsdfsd
            iofjsjofdsd" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="sjfdiosjdfiosjdfoijsdfjisdjfosjdfiosjdfiosdjf
            sdjf
            jsdjfosijdfo
            sjdf
            jsd
            fs
            dfjsdfdfsdfsdfsd
            iofjsjofdsd" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="sjfdiosjdfiosjdfoijsdfjisdjfosjdfiosjdfiosdjf
            sdjf
            jsdjfosijdfo
            sjdf
            jsd
            fs
            dfjsdfdfsdfsdfsd
            iofjsjofdsd" />

    </LinearLayout>

</ScrollView>


@Override
    public void onReceive(Context context, Intent intent)
    {
        super.onReceive(context, intent);

        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout_copy);
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        ComponentName cpName = new ComponentName(context, EmateWidget.class);
        appWidgetManager.updateAppWidget(cpName, remoteViews);
    }

1 个答案:

答案 0 :(得分:0)

ScrollView无法用于AppWidgets,请参阅Documentation