How I create a background with stripes using shapes, not image
android
Solution
This is my 9 patch (I called it `/res/drawable/stripes_vert_4.9.png`):
<= LOOK! It's here! It's 14*5 px in size, including the borders. Weight: 205 bytes
This is the result when set as background:
Now a semi-opaque gradient (I called it `/res/drawable/bg_stripes_vert_gradient`):
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<gradient
android:startColor="#0000"
android:endColor="#8000"
android:gradientRadius="180"
android:type="linear"
android:angle="-90"
/>
</shape>
Play with the start|center|endColor to get the best balance. Now, the layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/stripes_vert_4"
>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_stripes_vert_gradient"
/>
</RelativeLayout>
And the ultimate result:
Problem
I was wondering how I can create a background with lines of different colors without actually add a background image. I wanted to solve it using any shape or some code in java. Thank you very much!