Last active
May 12, 2021 10:34
-
-
Save wassim93/f586c15eb8aa3f1ca6d6c62d28ba4883 to your computer and use it in GitHub Desktop.
add border to layout in android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
<?xml version="1.0" encoding="UTF-8"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | |
<corners android:radius="20dp"/> | |
<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/> | |
<stroke android:width="1dp" android:color="#CCCCCC"/> | |
</shape> | |
Now apply it as a background to your smaller layout: | |
<LinearLayout android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:background="@drawable/customborder"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment