我一直没能抓住这个问题。如果你找到一个,请指出我。虽然 textview 正在处理点击,但 drawable 不是 null 但它没有显示图像
strengthtv = (TextView) findViewById(R.id.strengthtv);
strengthtv.setOnClickListener(strengthivListener);
performancetv = (TextView) findViewById(R.id.performancetv);
performancetv.setOnClickListener(performanceivListener);
shapetv = (TextView) findViewById(R.id.shapetv);
shapetv.setOnClickListener(shapeivListener);
...
switch (Prefs.PRODUCT) {
case Prefs.APP_HC:
Drawable strengthhc = resources.getDrawable(R.drawable.btn_goals_focus_bal_hc_2x_s);
Drawable perfhc = resources.getDrawable(R.drawable.icon_goals_performance_hc_2);
Drawable shapehc = resources.getDrawable(R.drawable.icon_goals_shape_hc_2x);
Log.v("setgoals", " drawables------> " + strengthhc + " -- "+ perfhc + " -- "+ shapehc);
strengthtv.setCompoundDrawables(null, strengthhc, null, null);
performancetv.setCompoundDrawables(null, perfhc, null, null);
shapetv.setCompoundDrawables(null, shapehc, null, null);
break;
case Prefs.APP_BF:
Drawable strengthbf = resources.getDrawable(R.drawable.btn_goals_focus_bal_bf_2x_s);
Drawable perfbf = resources.getDrawable(R.drawable.icon_goals_performance_bf_2);
Drawable shapebf = resources.getDrawable(R.drawable.icon_goals_shape_bf_2x);
Log.v("setgoals", " drawables------> " + strengthbf + " -- "+ perfbf + " -- "+ shapebf);
strengthtv.setCompoundDrawables(null, strengthbf, null, null);
performancetv.setCompoundDrawables(null, perfbf, null, null);
shapetv.setCompoundDrawables(null, shapebf, null, null);
break;
}