I wanna to create Layout like this
And i achived this My problem is i don't know how to get curve shape in layout please help me.
Here is my code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.HomeActivity">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/sky">
</RelativeLayout>
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignBottom="@id/relativeLayout1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="-30dp"
android:src="@mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/relativeLayout1">
</RelativeLayout>
</RelativeLayout>
Use CardView for Round Rectangle. CardView give more functionality like cardCornerRadius, cardBackgroundColor, cardElevation & many more. CardView make UI more suitable then Custom Round Rectangle drawable.
What is shape explain in detail in android? The shape is the XML Element which is defined in XML. and must be the root element. The file location is : res/drawable/your_shape.xml. The filename is used as the resource ID.25-Aug-2016.
i guess its too late, but it'll help others.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorSignInText"/>
</shape>
</item>
<item
android:top="100dp"
android:bottom="0dp"
android:left="-70dp"
android:right="-70dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="50dp"
android:shape="rectangle"
android:useLevel="true">
<solid android:color="@android:color/white"/>
<corners
android:bottomLeftRadius="0dp"
android:topLeftRadius="260dp"
android:topRightRadius="260dp"/>
</shape>
</item>
</layer-list>
Here take a look at the output:
Check out this library over here: https://github.com/developer-shivam/Crescento You can use this effect as is OR you can have a peek into source code and see the implementation for yourself!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With