How can I create a border around an Android LinearLayout?

前端 未结 9 1146
长发绾君心
长发绾君心 2020-12-22 20:33

I have one big layout, and one smaller layout inside of it.

How do I create a line border around the small layout?

9条回答
  •  余生分开走
    2020-12-22 21:31

    you can do it Pragmatically also

      GradientDrawable gradientDrawable=new GradientDrawable();
       gradientDrawable.setStroke(4,getResources().getColor(R.color.line_Input));
    

    Then set the background of layout as :

    LinearLayout layout = (LinearLayout ) findViewById(R.id.ayout); layout .setBackground(gradientDrawable);
    

提交回复
热议问题