で属性を解決するために失敗しました:アンドロイドAppWidget - エラー膨らまビュー:私はこのエラーを生成しているAppWidgetを持つインデックス
W/AppWidgetHostView: updateAppWidget couldn't find any view, using error view android.view.InflateException: Binary XML file line #2: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f01009a a=-1} Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f01009a a=-1}
私はレイアウトの膨張によって引き起こされているエラーを伝えることができ、そして私ができますこの行をコメントアウト
@Override
public RemoteViews getViewAt(int position) {
[…]
final RemoteViews views = new RemoteViews(getPackageName(),
R.layout.appwidget_list_item);
[…]
return views;
}
は、この特定のエラーを削除し、まだ私はそれを参照しているレイアウトファイルと間違っているかを把握することはできません。私のRemoteViewsService.RemoteViewsFactory
サブクラスgetViewAt()
方法で新しいRemoteViews
の創造にそれをピン。
レイアウトファイル:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_view"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="?listPreferredItemHeight">
<TextView
android:id="@+id/item_name"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center_vertical"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingStart="?listPreferredItemPaddingLeft"/>
</LinearLayout>