Viewpager advanced search
I have implemented SearchView inside my android app that uses a toolbar, SlidingTabLayout and a ViewPager that contains fragments.
but the SearchView collapsed and reset the TextView which time I scroll to another slice
how can I keep the SearchView expanded while scrolling to search for multiple fragments
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.searchmenu, menu);
mSearchMenuItem = menu.findItem(R.id.action_search);
searchView = (SearchView) MenuItemCompat.getActionView(mSearchMenuItem);
searchView.setOnQueryTextListener(this);
return true;
}
Layout:
<item
android:id="@+id/action_search"
android:icon="@android:drawable/ic_menu_search"
android:title="@string/search"
app:showAsAction="always|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView" />
+3
source to share
No one has answered this question yet
Check out similar questions: