在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sahildave/Search-View-Layout开源软件地址(OpenSource Url):https://github.com/sahildave/Search-View-Layout开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):THIS PROJECT IS DEPRECATEDComponent is not maintained anymore.Implementation of Lollipop+ Dialer and Google Maps. DEMOAdd in ViewAdd to your layout by using the include tag. <include layout="@layout/widget_search_bar"/> APIThis overlays the full activity and shows the fragment which you have assigned by using searchViewLayout.setExpandedContentFragment(this, new SearchStaticFragment()); If you want to animate your Toolbar too like the demo gif, you can enable it by using searchViewLayout.handleToolbarAnimation(toolbar); Setting Background colors for Transition. Default should also work just fine: // Create Drawable for collapsed state. Default color is android.R.color.transparent
ColorDrawable collapsed = new ColorDrawable(
ContextCompat.getColor(this, R.color.colorPrimary));
// Create Drawable for expanded state. Default color is #F0F0F0
ColorDrawable expanded = new ColorDrawable(
ContextCompat.getColor(this, R.color.default_color_expanded));
// Send both colors to searchViewLayout
searchViewLayout.setTransitionDrawables(collapsed, expanded); Listen to search complete by: searchViewLayout.setSearchListener(new SearchViewLayout.SearchListener() {
@Override
public void onFinished(String searchKeyword) {
searchViewLayout.collapse();
Snackbar.make(searchViewLayout, "Search Done - " + searchKeyword, Snackbar.LENGTH_LONG).show();
}
}); Listen to collapse/expand animation by using searchViewLayout.setOnToggleAnimationListener(new SearchViewLayout.OnToggleAnimationListener() {
@Override
public void onStart(boolean expanded) {
if(expanded) {
fab.hide();
} else {
fab.show();
}
}
@Override
public void onFinish(boolean expanded) { }
}); Listen to search box complete by: searchViewLayout.setSearchBoxListener(new SearchViewLayout.SearchBoxListener() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
}); Setting Hints If you want to set hints in the view, there are three APIs. searchViewLayout.setCollapsedHint("Collapsed Hint");
searchViewLayout.setExpandedHint("Expanded Hint");
searchViewLayout.setHint("Global Hint"); Setting Icons
Use NOTES
GETAvailable at jCenter and mavenCentral. dependencies {
compile 'xyz.sahildave:searchviewlayout:0.6'
} CHANGELOG0.6
0.5
0.4
0.3
0.2
0.1
0.0.2
ContributeContribute by creating issues (tagged enhancement, bugs) in the repo or create a pull request. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论