NavigationList is one more type of navigation in ActionBar's which serves the same functionality as tabs.
Let me show you how this look's like
In the above pic, Upon click of Inbox, the navigation list appears.
The above method should be called from onCreate() method of your SherlockActivity.
This method defines ActionBar, Prepares the Adapter for NavigationList, sets call back for Navigation List item click.
Related topics:
Let me show you how this look's like
Gmail App with Navigation list mode |
If you are not familiar with the configuration of Sherlock Action Bar project please refer my previous post.
Comming back...To achieve List style of navigation mode, set the navigationmode of Action bar to ActionBar.NAVIGATION_MODE_LIST and pass the respective adapter for this list. The code is shown below.
/** * Initialises the views and variables of the activity. */ private void init() { // initialise ActionBar mActionBar = getSupportActionBar(); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Initialise Array Adapter. final ArrayAdapterarrayAdapter = new ArrayAdapter (this, android.R.layout.simple_spinner_dropdown_item, android.R.id.text1); arrayAdapter.add("Login"); arrayAdapter.add("Elections"); arrayAdapter.add("Maintainance"); arrayAdapter.add("Results"); // Set array adapter to navigation list, implement a listener for the list. mActionBar.setListNavigationCallbacks(arrayAdapter, new OnNavigationListener() { @Override public boolean onNavigationItemSelected(int arg0, long arg1) { Toast.makeText(SherlockListActionBarActivity.this, arrayAdapter.getItem(arg0), Toast.LENGTH_SHORT).show(); return false; } }); }
The above method should be called from onCreate() method of your SherlockActivity.
This method defines ActionBar, Prepares the Adapter for NavigationList, sets call back for Navigation List item click.
Related topics:
No comments:
Post a Comment