因此,我参与了一个旧项目,但它不会仅仅运行。天吧
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f010001 a=-1}
这是课程(已删除部分内容,因为我认为这是不必要的):
public class MyAppsTabPage extends ListTabPage {
private int categoryId;
public MyAppsTabPage(Context context) {
super(context);
}
@Inject protected Provider<AccountSource> accountSource;
@Inject protected StoreConfigSource storeConfigSource;
@Override protected void onCreate(AttributeSet attrs) {
super.onCreate(attrs);
TypedArray a = getContext().obtainStyledAttributes(attrs, se.appland.market.core.R.styleable.CategoryTabPage);
//the following line throws the error
this.categoryId = a.getInteger(se.appland.market.core.R.styleable.CategoryTabPage_appcom_categoryid, CategoryTileFetcher.ROOT_CATEGORY);
a.recycle();
}
public MyAppsTabPage(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyAppsTabPage(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override protected void onFinishInflate() {
super.onFinishInflate();
addUpdateOnAccountChange();
}
}
我的attrs.xml
就像
<declare-styleable name="CategoryTabPage">
<attr name="appcom_categoryid" format="integer" />
</declare-styleable>
任何线索我想念什么?