To avoid stretching when moving the image, you must define gravity. In my case, this helps with the solution mentioned:
android:gravity="top|left"
or programmatically:
private void shiftLayer(LayerDrawable pieceDrawable,int level){ int l=level * shiftSize; int r=0; int t=0; int b=0; pieceDrawable.setLayerInset(level, l, t, r, b); ((BitmapDrawable)pieceDrawable.getDrawable(level)).setGravity(Gravity.LEFT|Gravity.TOP); }
On the screen you can see that a single image is stretched and blurred on the left side


Roger alien
source share