Please provide me a better solution if you have I am working on android app in which on home Activity by using TabLaout&ViewPager i have added 5 tabs on below
- Home
- Social
- Notice
- Search
- Links
I have set for MainActivity in values/style but i have placed custom action bar tag in search.xml. I know how to add SearchView on action bar in activity but i am facing issues using fragments. My goal is just to show search view widget on action bar when user will on "Search" tab. On other tabs i don't want to show. Further more I have added
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/>
in Manifest file in tag and setHasOptionsMenu(true);
in Search Fragment. But action bar is showing on search screen without search View Widget, please correct me where i am doing wrong.
You have to add the SearchView only in the searchFragment:
searchFragment class:
menu_search xml: