0

I have requirement to create search as shown below. I have created fragment tab, inside that tab I should have data to be displayed as shown below in image. [1]: https://i.stack.imgur.com/Rn988.png

My java class is

public class FragmentTab extends SherlockListFragment {



@Override
public SherlockFragmentActivity getSherlockActivity() {
     return super.getSherlockActivity();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    return view;
}

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    setUserVisibleHint(true);
   // getActivity().getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.abs__action_bar_title_item);

}


}// class
Sanjeev Yadav
  • 2,921
  • 7
  • 24
  • 23

1 Answers1

0

You can simply add an ActionView for the search action to the ActionBar.

As I can see you already use ActionBarSherlock for backwards compatibility; you also can use the new ActionBarComapt starting from SDK 18, support library v7.

For details: http://developer.android.com/guide/topics/ui/actionbar.html#ActionView

Don't forget to support hardware search buttons on older devices (2.3.x) to trigger the action.

  • To add a filter to your listview: http://stackoverflow.com/questions/13579559/android-searchview-filter-for-list-view – user2627118 Jul 28 '13 at 08:15