XML シェイプ ドローアブルからビットマップを取得するにはどうすればよいですか。私は何を間違っていますか?
shadow.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270.0"
android:endColor="@android:color/transparent"
android:startColor="#33000000"
android:type="linear" />
<size android:height="7.0dip" />
</shape>
ドローアブルからビットマップを取得する私の方法:
private Bitmap getBitmap(int id) {
return BitmapFactory.decodeResource(getContext().getResources(), id);
}
渡された ID がshadow.xmlドローアブル IDの場合、getBitmap() は null を返します。