On Thu, May 17, 2012 at 1:28 PM, Put_tiMe <putt...@gmail.com> wrote:
> Nothing actually, here's my gallery definition.
>
> <Gallery
>                     android:id="@+id/Gallery"
>                     android:layout_width="match_parent"
>                     android:layout_height="70dip"
>                     android:spacing="25dip"
>                     android:gravity="center"
>                     android:unselectedAlpha="1.2" />
>
> Is it mandatory to provide a selector?
>
> I also tried adding the following 2 parameters:
>
> android:listSelector="@drawable/selection_image"
> android:drawSelectorOnTop="true"
>
> Even that didn't help.
>

You need to use something like this for the background of the *items*
displayed in the gallery:

<selector xmlns:android="http://schemas.android.com/apk/res/android";>
    <item android:drawable="@drawable/border_selected"
        android:state_selected="false"
        android:state_pressed="true" />
    <item android:drawable="@drawable/border_unselected" />
</selector>

And then provide appropriate drawables for border_selected and
border_unselected. For example, this will give you a rectangle
with rounded corners, you can use it to mark selected items
by setting different colors for selected/unselected.

Or provide your own 9patch images, etc.

<shape xmlns:android="http://schemas.android.com/apk/res/android";>
    <padding android:left="1dp"
             android:top="1dp"
             android:right="1dp"
             android:bottom="1dp" />
    <stroke android:width="1dp" android:color="#ffff0000" />
    <corners android:radius="1dp" />
</shape>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to