0

각 항목을 재활용보기에 추가하고 싶습니다. 누구든지 재활용보기에 라디오 버튼을 추가하는 방법을 알고 있습니까? 당신은,833,655에 대해 별도의 layout xml 파일을 추가 할 필요가재활용보기에 라디오 버튼을 추가하는 방법은 무엇입니까?

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@color/background" 
tools:context=".UserSearchActivity"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="@color/primary" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 
     <android.support.v7.widget.SearchView 
      android:id="@+id/search" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:imeOptions="actionSearch|flagNoExtractUi" 
      android:theme="@style/SearchView" 
      app:defaultQueryHint="@string/hint_type_name_or_email" /> 
    </android.support.v7.widget.Toolbar> 
</android.support.design.widget.AppBarLayout> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_user" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginTop="?attr/actionBarSize" /> 
</FrameLayout> 
+0

여기서 list_item xml 파일은 어디에 있습니까? – piotrek1543

답변

0

:이

and this is i want to be

내 코드를 원하는

This is my recycler view

:

내 리사이클이다항목에는 radio button이 포함됩니다. 예를 들어

recycler_item.xml

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <RadioButton 
    android:id="@+id/radioButton" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_horizontal" 
    android:text="New RadioButton" /> 

</LinearLayout> 

다음 recycler list view adapter를 사용하여 항목 알엇를 업데이트합니다.

+0

사용자 정의 리사이클 뷰 어댑터 클래스를 추가하고 어댑터 클래스에서 라디오 버튼 가시성을 처리합니다. –

관련 문제