Reputation: 252
I need to create layout which has top left and right corners have rounded corner also i have tried by drawable radios but i have imageview which is inside my parent layout so thats why i am not getting my desired shape.
Can anyone help me to achieve this kind of UI
Upvotes: 0
Views: 1928
Reputation: 201
You can Create Drawable resourse with radius at top left and top right an set it as background to the layout or you can use this library https://github.com/florent37/ShapeOfView
Upvotes: 2
Reputation: 894
This is what you can possibly use . For your desired colour use different colour you want. Use this only for the layouts where you want rounded corners and not on the parent layout
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@android:color/white" />
<corners android:radius="15dp" />
<padding
android:bottom="5dp"
android:left="10dp"
android:right=10dp"
android:top="5dp" />
</shape>
Upvotes: 0
Reputation: 376
Have you tried adding by creating a new drawable resource file?
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#a9c5ac" >
</solid>
<!-- view border color and width -->
<stroke
android:width="3dp"
android:color="#1c1b20" >
</stroke>
<!-- If you want to add some padding -->
<padding
android:left="4dp"
android:top="4dp"
android:right="4dp"
android:bottom="4dp" >
</padding>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
</shape>
Add this in your required layout file
Upvotes: 0
Reputation: 626
Try this :
<corners android:topLeftRadius="6dp" android:topRightRadius="6dp"
android:bottomLeftRadius="0.1dp" android:bottomRightRadius="0.1dp"/>
as drawable. Source - Android - drawable with rounded corners at the top only
Upvotes: 0