1
我使用以下代碼來定義按鈕背景:我如何使用變量作爲getResourceId(int index,int defValue)中的索引;
TypedArray bottombuttons = res.obtainTypedArray(R.array.bottombuttons);
button0.setBackgroundResource(bottombuttons .getResourceId(index, 1));
其中index
是可變來自共享活動
int index = themePref.getInt("index", 1);