3
我試圖把Android的實習生圖標(anrdoid.R.drawable.bla)放到ImageButton 中,我想改變圖標的顏色(不是背景!),但它不起作用,就像我想要。如何更改實習生Android可繪製的顏色?
這裏是我試過:
從佈局我的ImageButton:
<ImageButton
android:id="@+id/imageButton1"
android:layout_marginTop="100dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"
android:src="@android:drawable/ic_lock_silent_mode" />
什麼我試着在我的活動:
Drawable myIcon = getResources().getDrawable(android.R.drawable.ic_lock_silent_mode);
ColorFilter filter = new LightingColorFilter(R.color.blue, R.color.blue);
myIcon.setColorFilter(filter);
無論什麼樣的價值觀我已經試過了LightingColorFilter,它總是給出相同的結果。 Imagebutton內的圖標變暗。但那不是我所想的。我只是想從我的colors.xml中應用一種顏色,但它無法解決問題。
這就是我要去的正確方向嗎?還是有另一種opertunity(我的意思不是着色自己在Photoshop和將它們放入了繪圖資源文件夾)
謝謝!完美的作品 – user2043332 2013-04-05 13:46:59
沒問題,很高興我可以幫忙) – 2013-04-05 13:47:33