How can I create a border around an Android LinearLayout?

前端 未结 9 1087
长发绾君心
长发绾君心 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:18

    Sure. You can add a border to any layout you want. Basically, you need to create a custom drawable and add it as a background to your layout. example:

    Create a file called customborder.xml in your drawable folder:

    
     
        
       
       
     
    

    Now apply it as a background to your smaller layout:

    
    

    That should do the trick.

    Also see:

    • http://tekeye.biz/2012/add-a-border-to-an-android-layout
    • How to add border around linear layout except at the bottom?

提交回复
热议问题