2

I am trying to do a background for listview items similar to this one. That blue line which indicates selected item has glowing affect on it. I want that:

enter image description here

What I am able to get is something like this:

enter image description here

I have been looking for a solution for about 3 hours now, so help would be greatly appreciated. How to achieve it? Here is what I have come up with in my drawable:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/dark_brown" />
            <size android:width="5dp" />
        </shape>
    </item>

    <item android:left="5dp"
        android:right="180dp">

        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">

            <gradient
                android:startColor="@color/dark_brown"
                android:endColor="@color/text_light"
                android:angle="0" />
        </shape>
    </item>

    <item android:left="5dp">
        <shape android:shape="rectangle">
            <solid android:color="@color/text_light" />
        </shape>
    </item>
</layer-list>
Seraphim's
  • 12,559
  • 20
  • 88
  • 129

1 Answers1

0

I believe what you want is a gradient on the right of your solid bar that fades either to transparent or the background color of your cell. You'll want to tweak the size of it, and maybe add a centerColor to get it to look just right, but that should get you closer to what you're looking for.

As wrecker mentioned, you could also use an image for this (like a 9-patch)

Matt
  • 3,837
  • 26
  • 29