0

I have an ExpandableListView, group view contains RadioButtons.
I'm wondering, is it a way to know, what are states of that RadioButtons when I press an ExpandableListView group?

What I need - to make selector and use android:state_pressed on my RadioButton.
But when I press on list group (not on RadioButton), state_pressed is also invoked.

I need to avoid this.

Also - is it a way to extract all states of the view in runtime (and log them, for example)?

Here is my group view layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/headerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/inactive_field"
    android:padding="10dp"
    android:descendantFocusability="blocksDescendants">

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_toLeftOf="@+id/headerSegmentedText"
        android:layout_toStartOf="@+id/headerSegmentedText"
        android:layout_marginRight="10dp"
        android:layout_marginEnd="10dp"
        android:layout_centerVertical="true"
        android:gravity="start"
        android:textSize="16sp"
        android:text="TESTEEXt"
        android:textColor="@color/youfone"/>

    <com.myproj.ui.views.SegmentedRadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:layout_marginEnd="10dp"
        android:orientation="horizontal"
        android:id="@+id/headerSegmentedText"
        android:layout_toLeftOf="@+id/headerArrow"
        android:layout_toStartOf="@+id/headerArrow"
        android:layout_centerVertical="true"
        android:checkedButton="@+id/button_3">
        <RadioButton android:id="@+id/button_3"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:minWidth="40dp"
                     android:minHeight="33dp"
                     android:text="3"
                     android:textAppearance="?android:attr/textAppearanceSmall"
                     android:button="@null"
                     android:gravity="center"
                     android:textColor="@color/radio_colors"/>
        <RadioButton android:id="@+id/button_4"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:minWidth="40dp"
                     android:minHeight="33dp"
                     android:text="4"
                     android:button="@null"
                     android:gravity="center"
                     android:textAppearance="?android:attr/textAppearanceSmall"
                     android:textColor="@color/radio_colors" />
    </com.myproj.ui.views.SegmentedRadioGroup>

    <ImageView
        android:id="@+id/headerArrow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_centerVertical="true"
        android:src="@drawable/arrow_selector"/>
</RelativeLayout>
Goltsev Eugene
  • 3,325
  • 6
  • 25
  • 48

1 Answers1

0

Ok, so @youzking commented and gave me a really good tip.
Further search led me to this great post.

Recommended layout override did the trick.

Community
  • 1
  • 1
Goltsev Eugene
  • 3,325
  • 6
  • 25
  • 48