Skip to content Skip to sidebar Skip to footer

Android: How To Create Shape With Skewed Two-tone Color?

I am attempting to create a drawable shape that will become the background of a search bar. I know how to create a rectangle with two colors but I do not know how to tilt the color

Solution 1:

Take a Toolbar...code is here...

<android.support.v7.widget.Toolbarandroid:layout_width="500dp"android:layout_height="wrap_content"android:background="@drawable/custom_background" />

create a drawable res file custom_background.xml and

In that toolbar set drawable like this....code is here

<?xml version="1.0" encoding="UTF-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android" ><item><shapeandroid:shape="rectangle"><sizeandroid:width="500dp"android:height="50dp" /><solidandroid:color="#0072BC" /><cornersandroid:radius="0dp"/></shape></item><itemandroid:top="8dp"android:bottom="0dp"android:left="-400dp"android:right="128dp"><rotateandroid:fromDegrees="160"><shapeandroid:shape="rectangle"><solidandroid:color="#FFF" /></shape></rotate></item>

Post a Comment for "Android: How To Create Shape With Skewed Two-tone Color?"