2017-01-30 9 views
0

RecyclerViewから選択した値をフィルタリングする必要があります。RecyclerViewSearchViewを使用しています。RecyclerView内でSearchViewを実装する方法

activity_main.xml 
<android.support.v7.widget.SearchView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/search" 
    android:hint="Enter any location"/> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recyclerview" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="8dp" 
    android:layout_marginTop="50dp" 
    /> 

dealer_item.xml

<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/card_view" 
    android:layout_width="fill_parent" 
    android:layout_height="100dp" 
    card_view:cardCornerRadius="4dp" 
    card_view:contentPadding="15dp"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/dealer_name" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

     <TextView 
      android:id="@+id/dealer_loc" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</android.support.v7.widget.CardView> 

私も、アダプタ、モデルとMainActivityのJavaファイルを持っています。 これで助けてください。

答えて

関連する問題