I have tried it but i doesn't work for me yet..
i have done this
this is my main.xml which i call in my activity
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:baselineAligned="false"
6 android:orientation="horizontal" >
7
8 <FrameLayout android:id="@+id/ListContent1"
9 android:layout_width="0dip"
10 android:layout_height="match_parent"
11 android:layout_weight="1" >
12
13 </FrameLayout>
14
15 <SearchView
16 android:layout_width="match_parent" // I HAD TO ADD THIS BECAUSE ELSE I GOT A ERROR
17 android:layout_height="match_parent" // THIS TO
18 style="@style/android:Theme.Holo">
19 </SearchView>
20
21</LinearLayout>
add i have done this i my code
1MenuItem item = menu.add("Search");
2 item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
3 SearchView sv = new SearchView(getActivity(), attributes);
4 sv.setOnQueryTextListener(this);
5 item.setActionView(sv);
but it only adds a extra searchview in the middle of my activity
and doesn't change the old one
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.