ceryle / RadioRealButton

A custom radio button for Android API 12+
Apache License 2.0
259 stars 73 forks source link

how to get 'Textview' from 'Radio Button' in programmatically? #40

Open DevSanSon opened 6 years ago

DevSanSon commented 6 years ago

`<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <co.ceryle.radiorealbutton.library.RadioRealButtonGroup
        android:id="@+id/radioGroupBtnMatcher"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:rrbg_animateDrawables_enter="overshoot"
        app:rrbg_animateTexts_enter="overshoot"
        app:rrbg_dividerColor="@color/colorAccent"
        app:rrbg_dividerSize="1dp"
        app:rrbg_selectorColor="@color/colorPrimaryDark"
        app:rrbg_selectorSize="6dp">

        <co.ceryle.radiorealbutton.library.RadioRealButton
            android:id="@+id/btnRadioOne"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="15dp">

            <ImageView
                android:id="@+id/imageFirst"
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_marginBottom="3dp"
                android:layout_marginTop="3dp" />

            <TextView
                android:id="@+id/nameFirst"
                android:layout_width="115dp"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:text="line 1"
                android:textColor="@android:color/black"
                android:textSize="9dp"
                android:textStyle="bold" />
        </co.ceryle.radiorealbutton.library.RadioRealButton>

        <co.ceryle.radiorealbutton.library.RadioRealButton
            android:id="@+id/btnRadioTwo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="15dp"
            android:paddingRight="15dp">

            <ImageView
                android:id="@+id/imageSecond"
                android:layout_width="42dp"
                android:layout_height="42dp"
                android:layout_marginBottom="3dp"
                android:layout_marginLeft="15dp"
                android:layout_marginTop="3dp" />

            <TextView
                android:id="@+id/nameSecond"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:text="line 1"
                android:textColor="@android:color/black"
                android:textSize="9dp"
                android:textStyle="bold" />
        </co.ceryle.radiorealbutton.library.RadioRealButton>

    </co.ceryle.radiorealbutton.library.RadioRealButtonGroup>
</RelativeLayout>

</android.support.v7.widget.CardView>`

I use recyclerView. So I can't get TextView value and ImageView url. How do it?

btns.setOnClickedButtonListener(new RadioRealButtonGroup.OnClickedButtonListener() { @Override public void onClickedButton(RadioRealButton button, int position) { Log.i("AlDAA", "OnClick"); Toast.makeText(MatchAdapter.context, "Clicked: "+position+" "+button, Toast.LENGTH_SHORT).show(); } });

this is not working :( 👎