List of usage examples for android.graphics.drawable NinePatchDrawable setBounds
public void setBounds(int left, int top, int right, int bottom)
From source file:com.github.shareme.gwsmaterialuikit.library.advancerv.draggable.DraggingItemDecorator.java
private Bitmap createDraggingItemImage(View v, NinePatchDrawable shadow) { int width = v.getWidth() + mShadowPadding.left + mShadowPadding.right; int height = v.getHeight() + mShadowPadding.top + mShadowPadding.bottom; final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(bitmap); if (shadow != null) { shadow.setBounds(0, 0, width, height); shadow.draw(canvas);/*from w w w .j ava 2 s . c om*/ } final int savedCount = canvas.save(Canvas.CLIP_SAVE_FLAG | Canvas.MATRIX_SAVE_FLAG); // NOTE: Explicitly set clipping rect. This is required on Gingerbread. canvas.clipRect(mShadowPadding.left, mShadowPadding.top, width - mShadowPadding.right, height - mShadowPadding.bottom); canvas.translate(mShadowPadding.left, mShadowPadding.top); v.draw(canvas); canvas.restoreToCount(savedCount); return bitmap; }
From source file:com.h6ah4i.android.materialshadowninepatch.MaterialShadowContainerView.java
private void updateNinePatchBounds(NinePatchDrawable ninePatch, int childLeft, int childTop, int childRight, int childBottom) { if (ninePatch == null) { return;/* ww w . j av a2 s. c o m*/ } final Rect t = mTempRect; ninePatch.getPadding(t); ninePatch.setBounds(childLeft - t.left, childTop - t.top, childRight + t.right, childBottom + t.bottom); }