SHARE
TWEET

QPUI Q&A

a guest Jun 18th, 2014 263 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.card_view_one); // id fetch from xml- If the id is different rename the id.
  2. ShapeDrawable rectShapeDrawable = new ShapeDrawable(); // pre defined class
  3.  
  4. // get paint
  5. Paint paint = rectShapeDrawable.getPaint();
  6.  
  7. // set border color, stroke and stroke width
  8. paint.setColor(Color.GRAY);
  9. paint.setStyle(Style.STROKE);
  10. paint.setStrokeWidth(1); // you can change the value to make it thicker. But 1 should be more appropriate.
  11. layout.setBackgroundDrawable(rectShapeDrawable);
  12.  
  13. QPUI - Krishneelg3
RAW Paste Data
Top