📌  相关文章
📜  android 视图以编程方式设置边框 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:02.451000             🧑  作者: Mango

代码示例1
//use a GradientDrawable with only one color set, to make it a solid color
    GradientDrawable border = new GradientDrawable();
    border.setColor(0xFFFFFFFF); //white background
    border.setStroke(1, 0xFF000000); //black border with full opacity
    if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
      TitleLayout.setBackgroundDrawable(border);
    } else {
      TitleLayout.setBackground(border);
    }