GradientDrawable extend beyond boundaries

19 views Asked by At

What to do if child layouts extend beyond root boundaries?

My code:


LinearLayour root = new LinearLayout(context);

LinearLayour head = new LinearLayout(context);

GradientDrawable gd = new GradientDrawable();

gd.setShape(GradientDrawable.RECTANGLE);

gd.setCornerRadius(14);

gd.setColor(Color.parseColor("#232425"));

root.setOrientation(LinearLayout.VERTICAL);

root.setBackground(gd);

head.setLayoutParams(new ViewGroup.LayoutParams(

    ViewGroup.LayoutParams.MATCH_PARENT,

    dpi(80)));

head.setBackgroundColor(Color.parseColor("#6C5EE5"));

root.addView(head);

Why it looks like that?:

https://i.imgur.com/dkI9LJx.png

I want it to be rounded everywhere.

0

There are 0 answers