Java Code Examples for android.support.v7.app.ActionBar#getCustomView()

The following examples show how to use android.support.v7.app.ActionBar#getCustomView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From QueryHighlighter with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAdapter = new CheesesAdapter();

    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.search_view);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    final EditText editText = (EditText) actionBar.getCustomView();
    editText.addTextChangedListener(mTextWatcher);
    editText.requestFocus();
}
 
Example 2
Source File: HomeScreenFragment.java    From Gazetti_Newspaper_Reader with MIT License 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.homescreen_fragment, container, false);

    ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar();
    actionBarCustomView = actionBar.getCustomView();

    gridview = (GridView) rootView.findViewById(R.id.gridview);
    phoneBackgroundImage = (ImageView) rootView.findViewById(R.id.phone_homescreen_background);

    fabMenu = (FloatingActionsMenu) rootView.findViewById(R.id.floating_action_menu);
    fabAddNew = (PlusFloatingActionButton) rootView.findViewById(R.id.fab_add_new_cell);
    fabBookmark = (FloatingActionButton) rootView.findViewById(R.id.fab_bookmark);
    fabEditFeeds = (FloatingActionButton) rootView.findViewById(R.id.fab_edit_feeds);
    return rootView;
}
 
Example 3
Source File: UIManagerAppCompat.java    From document-viewer with GNU General Public License v3.0 4 votes vote down vote up
public static void setProgressSpinnerVisible(AppCompatActivity activity, boolean visible) {
    ActionBar bar = activity.getSupportActionBar();

    if (bar.getCustomView() == null) {
        ProgressBar spinner = new ProgressBar(activity);
        spinner.setIndeterminate(true);
        bar.setCustomView(spinner);
    }

    bar.setDisplayShowCustomEnabled(visible);
}