Skip to content

Instantly share code, notes, and snippets.

@prasad091
Last active January 3, 2017 08:49
Show Gist options
  • Save prasad091/933630ae8abbb3d10b0e55c6f9b55a73 to your computer and use it in GitHub Desktop.
Save prasad091/933630ae8abbb3d10b0e55c6f9b55a73 to your computer and use it in GitHub Desktop.
Search in Toolbar
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13.3843083,13.3956843 C11.233862,15.5399983 7.7581039,15.5381046 5.61000013,13.3900003 C3.46000004,11.2399998 3.46000004,7.76000023 5.61000013,5.61000013 C7.76000023,3.46000004 11.2400007,3.46000004 13.3900003,5.61000013 C15.54,7.76000023 15.5400009,11.2400007 13.3900003,13.3900003 C13.388104,13.3918967 13.3862067,13.3937913 13.3843083,13.3956843 C15.1427975,15.1834093 19.6826174,19.798706 19.6826172,19.7987061 L13.3843085,13.3956846 L13.3843083,13.3956843 Z"
android:strokeWidth="2"
android:strokeColor="#ffffffff" />
</vector>
<activity android:name=".SearchActivity">
<meta-data
android:name="android.app.default_searchable"
android:value=".SearchActivity" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.MainActivity">
<group android:checkableBehavior="single">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search_24dp"
android:orderInCategory="100"
android:title="@string/app_name"
app:showAsAction="always" />
</group>
</menu>
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
MenuItem item = menu.findItem(R.id.action_search);
searchView.setMenuItem(item);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment