What you can do is:

1) Add another layout to your group item layout, make sure its size matches the entire group item. FrameLayout is probably easiest.
2) Specify your own state-list background drawable for this layout.
3) In this state-list drawable, specify transparent color for pressed / focused / selected state, and the color you want for normal state as the default.

The way this'll work is that the color from your state-list drawable will be used only if the item is not pressed / focused / selected. For those states, your drawable will turn transparent and let the android list item drawable show.

You'll also need android:duplicateParentState on the layout added in step 1.

-- Kostya

On 02/27/2012 06:31 PM, Bluemercury wrote:
Basically what i want is default behaviour in all states but with my own backgroud gradient....:S


On Monday, February 27, 2012 2:14:45 PM UTC, Bluemercury wrote:

    Hi! im currently using an expandable list as an n-tree level list,
    and i use the long click to select any element, either group or
    childs, the problem is that the group row has a gradient gradient
    backgroup so translates in it not having any kind of highlight. i
    managed the normal click color, but im not getting any luck with
    the long click animation:

    This is my group row xml:

    *<LinearLayout android:id="@+id/LinearLayout01"*
    *android:layout_width="fill_parent" android:layout_height="45dip"*
    *xmlns:android="http://schemas.android.com/apk/res/android
    <http://schemas.android.com/apk/res/android>"*
    *android:background="@drawable/expandable_group_item">*
    *<TextView *
    *android:id="@+id/tvGroup" *
    *android:layout_width="fill_parent"*
    *android:layout_height="45dip" *
    *android:text="Groups" *
    *android:gravity="center_vertical|right"*
    *android:paddingLeft="5dip" *
    *android:paddingRight="5dip"*
    *android:textColor="#ffffffff" *
    *android:textStyle="bold"*
    *android:textSize="17dip"> *
    *</TextView>*
    *</LinearLayout>*
    *
    *
    This is the expandable_group_item_selector:

    *<selector
    xmlns:android="http://schemas.android.com/apk/res/android
    <http://schemas.android.com/apk/res/android>">*
    *<item android:state_window_focused="false"
    android:drawable="@android:color/transparent" />*
    **
    *<item android:state_focused="true" android:state_pressed="true"*
* android:drawable="@drawable/list_selector_background_transition" />*
    *<item android:state_focused="false" android:state_pressed="true"*
* android:drawable="@drawable/list_selector_background_transition" />*
    *<item android:state_focused="true"*
* android:drawable="@+drawable/list_selector_background_focus" />*
    *<item android:state_focused="false"*
* android:drawable="@+drawable/gradient_dialog_header" />*
    *</selector>*

    The focus and long click animation still dont work any ideas?

    regards,

--
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

--
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