android view set border programmatically

Solutions on MaxInterview for android view set border programmatically by the best coders in the world

showing results for - "android view set border programmatically"
Alonso
08 Apr 2018
1    //use a GradientDrawable with only one color set, to make it a solid color
2    GradientDrawable border = new GradientDrawable();
3    border.setColor(0xFFFFFFFF); //white background
4    border.setStroke(1, 0xFF000000); //black border with full opacity
5    if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
6      TitleLayout.setBackgroundDrawable(border);
7    } else {
8      TitleLayout.setBackground(border);
9    }