1
我想設置圖像資源與絃樂無法解決方法setCompoundDrawablesWithIntrinsicBounds
我有設置setCompoundDrawablesWithIntrinsicBounds的問題,它不斷告訴我
cannot resolve method setCompoundDrawablesWithIntrinsicBounds(android.graphics.drawable.Drawable, 0, 0, 0);
我已經通過網上查,甚至在計算器,我的實現似乎是正確的,但我無法編譯。
String uri = "drawable/my_drawable_image";
int imageResource = getResources().getIdentifier(uri, null, getActivity().getPackageName());
Drawable image = getResources().getDrawable(imageResource);
myTextView.setCompoundDrawablesWithIntrinsicBounds(image, 0 ,0 , 0);
請問我在做什麼錯?
謝謝! .... –
不客氣 – Blackbelt