I am following the answer given here Array of images stacked next to each other, using LayerDrawable.(Displaying multiple image in single imageview) . My images are 38x38 sized.
This is my code:
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);
But that's what happens: layers misplaced
Any help?