Answers for "android button border radius programmatically"

0

how to add corner radius in android button

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/primary" />
    <corners android:radius="5dp" />
</shape>
Posted by: Guest on September-26-2020
0

set top corner of shape radius programmatically android

GradientDrawable shape =  new GradientDrawable();
 shape.setCornerRadius( 8 );

 // add some color
 // You can add your random color generator here
 // and set color
 if (i % 2 == 0) {
  shape.setColor(Color.RED);
 } else {
  shape.setColor(Color.BLUE);
 }

 // now find your view and add background to it
 View view = (LinearLayout) findViewById( R.id.my_view );
 view.setBackground(shape);
Posted by: Guest on April-19-2020

Code answers related to "android button border radius programmatically"

Browse Popular Code Answers by Language