Android Navigation: Menus, ActionBar/ToolBar, and Navigation Drawer Ro’zimurodov Nodirjon


super.onPostCreate(savedInstanceState)



Download 0,86 Mb.
bet7/7
Sana13.12.2022
Hajmi0,86 Mb.
#885109
1   2   3   4   5   6   7

super.onPostCreate(savedInstanceState);

// Sync the toggle state after onRestoreInstanceState has occurred.

mDrawerToggle.syncState();

}

@Override

public void onConfigurationChanged(Configuration newConfig) {

super.onConfigurationChanged(newConfig);

// Pass any configuration change to the drawer toggls

mDrawerToggle.onConfigurationChanged(newConfig);

}

DrawerLayout Java (4)

  • Lastly, a fix to the menu as well.
  • public boolean onOptionsItemSelected(MenuItem item) {

    // The action bar home/up action should open or close the drawer.

    // ActionBarDrawerToggle will take care of this.

    if (mDrawerToggle.onOptionsItemSelected(item)) {

    return true;

    } …

Demos

  • The NavDrawerFragDemo
    • Uses the Shakespeare fragments from listview demos in the Drawerlayout
      • Note the ListFragment, since you need to change the text color correctly, for a dark background and light text color.
      • Also changing the listview rowlayout.
  • NavDrawer is google example, show a listview and fragment.
    • Some corrections for the newer version of the drawerlayout.

ToolBar

  • The ToolBar is a replacement for the ActionBar
    • Basically everything works the same, but uses a androidx.appcompat.widget.Toolbar.
    • We can do a lot of things with the Toolbar, including animations and collapse it.
      • But that is for the advanced course.

Last example

  • Using an extended height toolbar, like googles example.
    • See TallToolbarDemo example.
      • In the toolbar set android:layout_height="112dp" and now you have a taller toolbar. (128dp on tablet)
  • Google’s example:

Last example (2)

  • talltoolbarDemo version:
  • Remember the buttons are just menu items

References

  • http://developer.android.com/guide/topics/resources/menu-resource.html
  • http://developer.android.com/reference/android/app/Fragment.html#onOptionsItemSelected%28android.view.MenuItem%29
  • http://developer.android.com/guide/topics/ui/actionbar.html
  • http://stackoverflow.com/questions/26491689/how-do-i-declare-an-extended-height-toolbar-action-bar-on-android-lollipop
  • http://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/
  • https://chris.banes.me/2014/10/17/appcompat-v21/

Q
A
&
Download 0,86 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish