Android Programlama -21

Merhaba arkadaşlar bu gün ki makalemde BottomNavigationView’ ın kullanımını göreceğiz.

Bir önceki makalede fragment konusuna değinmiştim. Okumadıysanız öncelikle onu okumanızı tavsiye ederim. Buradan okuyabilirsiniz.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.teka.icim_rahat.Icim_Rahat">

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

    </FrameLayout>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:menu="@menu/navigation" />

</LinearLayout>

Yazdığımız xml kodlamasının çıktısının ekran görüntüsü yukarıdaki gibi dir. Ekran görüntüsündeki telefonun alt kısmında bulunan butonlar ButtomNavigationView sayesinde eklenmiştir uygulamaya. Ekranın en alt kısmın da bulunan butunlar’a tıklandığın da farklı sayfalar açılmaktadır. Bu sayfalarda fragment ile kodlanmış sayfalardır. BottomNavigationView’i dogru kullanabilmemiz için framelayout kullanmalıyız xml kodlamamız da.

Burada önemli bir noktada BottomNavigationView da kaç tane sayfa olacağını belirlediğimiz kısımdır. Bunu bir menu dosyası oluşturarak app:menu=”@menu/navigation” xml kodlaması yardımı ile belirlemiş oluruz.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/ic_home_black_24dp"
        android:title="Fotograf" />

    <item
        android:id="@+id/navigation_dashboard"
        android:icon="@drawable/ic_group_black_24dp"
        android:title="Ögretmen" />

    <item
        android:id="@+id/navigation_notifications"
        android:icon="@drawable/ic_sentiment_satisfied_black_24dp"
        android:title="Ögrenci" />
    <item
        android:id="@+id/iletisim"
        android:icon="@drawable/ic_assignment_black_24dp"
        android:title="Hakkımızda">


    </item>
</menu>

Uygulamamız da kullandığımız menu kodları yukarıdaki gibidir. Her buton’u bir item temsil etmektedir. Her item’ın da id, icon ve tittle bilgileri mevcuttur.

Bir makalenin daha sonuna geldik, esenle kalın..

Kübra Hebeş

Bilgisayar Mühendisi

9 thoughts on “Android Programlama -21

  • Pingback:Android Programlama Dersleri | Information Technology Tutorials

  • May 12, 2019 at 7:27 am
    Permalink

    I do agree with all the concepts you’ve presented on your post. They’re very convincing and can definitely work. Still, the posts are too short for beginners. May you please extend them a bit from next time? Thank you for the post.|

    Reply
  • May 20, 2019 at 9:57 pm
    Permalink

    Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! However, how can we communicate?|

    Reply
  • May 21, 2019 at 1:07 am
    Permalink

    This piece of writing is really a pleasant one it assists new internet users, who are wishing in favor of blogging.|

    Reply
  • May 21, 2019 at 2:14 am
    Permalink

    I loved as much as you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get got an shakiness over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.|

    Reply
  • May 21, 2019 at 2:15 am
    Permalink

    I am not sure where you are getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for wonderful info I was looking for this information for my mission.|

    Reply
  • May 21, 2019 at 2:16 am
    Permalink

    Magnificent beat ! I wish to apprentice while you amend your web site, how could i subscribe for a blog website? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear idea|

    Reply
  • May 21, 2019 at 4:55 am
    Permalink

    Do you mind if I quote a few of your posts as long as I provide credit and sources back to your weblog? My blog is in the exact same area of interest as yours and my visitors would truly benefit from a lot of the information you present here. Please let me know if this alright with you. Many thanks!|

    Reply
  • May 21, 2019 at 5:06 am
    Permalink

    Hello mates, pleasant piece of writing and nice arguments commented at this place, I am genuinely enjoying by these.|

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *