MaterialSearchView
基于MD风格的Android搜索视图。
下载
为了在AndroidStudio项目中添加MaterialSearchView库直接在gradle 依赖中添加:
compile 'br.com.mauker.materialsearchview:materialsearchview:1.2.2'
Setup
使用这个库之前,你需要实现一个名为MsvAuthority的类。
示例:
MsvAuthority.java
package br.com.mauker;
public class MsvAuthority {
public static final String CONTENT_AUTHORITY = "br.com.mauker.materialsearchview.searchhistorydatabase";
}
AndroidManifest.xml
android:name="br.com.mauker.materialsearchview.db.HistoryProvider"
android:authorities="br.com.mauker.materialsearchview.searchhistorydatabase"
android:exported="false"
android:protectionLevel="signature"
android:syncable="true"/>
设置视图样式
你可以改变MaterialSearchView的样式,只需在styles.xml中添加:
@color/white_ish
@drawable/ic_action_voice_search
@drawable/ic_action_navigation_close
@drawable/ic_action_navigation_arrow_back
@color/search_layover_bg
?attr/actionBarSize
@string/hint_prompt
@color/black
@color/gray_50
@string/search_hint
textCapWords
在br.com.mauker.materialsearchview.MaterialSearchView标签中缇娜及:
style="@style/MaterialSearchViewStyle"
它看起来是:
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/MaterialSearchViewStyle"/>
语言
MaterialSearchView 支持下列语言:
English?
Brazillian Portuguese?
Italian?
French?
Bosnian, Croatian 和 Serbian?
Sample GIF