2017-09-06 12 views
1

私はアクションバーとツールバーなしでsearchviewを実装しています。すべてが固定されています。以下は私のXMLです。戻るボタンでの検索ビュー

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 

    <SearchView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:animateLayoutChanges="true""> 
    </SearchView> 
</RelativeLayout> 

このようなものがあります。以下は

enter image description here

私は必要なものの画像です。

enter image description here

すべてのヘルプは素晴らしいことです。

+0

代わりのレイアウトアドオンで追加するための

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/menu_search_album" android:icon="@drawable/ic_search" android:title="@string/str_search_album" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="collapseActionView|always" /> </menu> 

** android.support.v7.widget.SearchView **メニューで、それは動作します良い。 –

答えて

0

API 21+ではandroid:searchIcon="[your drawable here]"を使用できます。

関連する問題