Download presentation
Presentation is loading. Please wait.
Published byWesley Haynes Modified over 9 years ago
1
Action Bar Action Bar Contains Logo Application Name Options Menu SW in Android 3.0 and above was HW in Older Versions
2
Action Bar & Options Menu Older Versions vs Newer Versions
3
Options Menu Code @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu adding items to the action bar getMenuInflater().inflate(R.menu.my, menu); return true; }
4
Menu Items If (menu items do not displayed in the action bar) → {they are shown in the overflow menu} Otherwise → {they are called action items}
5
ShowAsAction Values
6
Menu Item Icon (1) 1- System Drawable Resources (android.R.drawable) contains many suitable menu icons should not be used directly
7
Menu Item Icon (2) 2- Other Resources http://developer.android.com/guide/topics/resources/menu- resource.html http://developer.android.com/guide/topics/resources/menu- resource.html http://androiddrawables.com/ android:icon="@+drawable/menu_icon_name"
8
onOptionsItemSelected Toast.makeText( getApplicationContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
9
Action Bar New Features 1- Drop Down Navigation * R.layout.simple_spinner_item (Spinner) * R.layout.simple_spinner_dropdown_item (AutoCompleteTextView) * Creating Custom Layout 2- Tabs for Navigation
10
Drop Down Navigation Code
11
Tabs for Navigation Code
12
Old Android Versions Tips Use menu options only Create an initial branching activity if (android.os.Build.VERSION.SDK_INT>= android.os.Build.VERSION_CODES.HONEYCOMB) {} Create a layout for versions lower than Honeycomb http://developer.android.com/samples/index.html Use a third-party product called ActionBarSherlock
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.