I am using the blow code but not understand what parameter should i set in setLayerInset.According to my experiment i used the blow parameter to set drawable ans draw border over this drawable. The problem is what i am facing now my layout is re-sizing on tap. I have views in a horizontal Linear layout.When i click and set border on a image it works fine when i select second image the Layout will re-size. Strange thing is that it happens(Layout re-sizing) only one time.
I thing on drawing border the view size is reducing by 1 so this may be the resion that layout is re-sizing.But why this happen only once. How to get rid of it.
Is there any trick or formula to get parameters which we can set in "setLayerInset" method. so that the original image size will not fluctuate.
Rect dbounds = drble.getBounds();
Drawable drawableRes = getResources().getDrawable(R.drawable.shape);
ld.setBounds(dbounds);
Drawable[] drawableLayers = { drble, drawableRes };
ld = new LayerDrawable(drawableLayers);
ld.setLayerInset(0, 0, 0, 0, 0);
ld.setLayerInset(1, 0, 1, 0, 1);
imgview.setBackground(ld);
In this code "drable" is my "Drawable" object and "drawableRes" is my "shape" which i design in xml to draw border on the selected view.