Set size of Layered Drawable?

白昼怎懂夜的黑 提交于 2019-12-04 03:44:57

Funny that shorty after I posted this, I found the answer. I was looking in all of the wrong places to resize the image. I tried the bitmap, the drawable, the layers inside of the layerdrawable. But, what I never tried was the layerdrawable itself. The solution is below:

  Resources r = getResources();
    Drawable[] layers = new Drawable[2];
    layers[0] = draw;
    layers[1] = r.getDrawable(R.drawable.border);
    LayerDrawable layerDrawable = new LayerDrawable(layers);
    layerDrawable.setLayerInset(0, 0, 0, 0, 12);
    draw = layerDrawable;

The layerDrawable inset method is as follows:

layerDrawable.setLayerInset(*index of layer*, *left inset*, *top*, *right*, *bottom*);

Thanks guys!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!