0
我正在按照這裏給出的答案Array of images stacked next to each other, using LayerDrawable.(Displaying multiple image in single imageview) 。我的圖像是38x38大小。多圖像單視圖錯位Android
這是我的代碼:
Drawable[] layers = new Drawable[2];
layers[0]=cActivity.getResources().getDrawable(R.drawable.white_pawn);
layers[1]=cActivity.getResources().getDrawable(R.drawable.black_pawn);
LayerDrawable pawns = new LayerDrawable(layers);
pawns.setLayerInset(0, 0, 0, 42, 0);
pawns.setLayerInset(1, 42, 0, 42, 0);
((ImageView)v.findViewById(R.id.baseImage)).setImageDrawable(pawns);
但是,這是發生了什麼:layers misplaced
任何幫助嗎?
好吧,你是對的,只是嘗試過,它的工作,ty!事情就是setGravity方法不適用於Drawables,這就是爲什麼我被迫使用BitMap Drawable的原因,我想避免這種情況,因爲它似乎沒有它。但你是對的,非常先生! – Ssr1368 2014-09-05 23:12:02