Android Programlama – 24

Merhaba arkadaşlar, bu gün ki makalemde Tabbed activity kullanımı göreceğiz.

Daha önce yazdığım makaleleri okumadıysanız öncelikle onları okumanızı tavsiye ederim. Buradanokuyabilirsiniz.

Tabbed activity’nin kullanımı kolaylaştırmak için Android studio hazır şablon oluşturmuştur. Yeni proje oluşturduğumuz da bu şablonunu seçerek projemize ekleyebiliriz. Bu makalede xml kodlamasını yapacağız

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout

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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.recodedharran.guidetour.ActivityGuideTour">

<android.support.design.widget.AppBarLayout
android:id=”@+id/appbar”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:paddingTop=”@dimen/appbar_padding_top”
android:theme=”@style/AppTheme.AppBarOverlay”>

<android.support.design.widget.TabLayout
android:id=”@+id/tabs”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<android.support.design.widget.TabItem
android:id=”@+id/tabItem”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”@string/tab_text_1″ />

<android.support.design.widget.TabItem
android:id="@+id/tabItem2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tab_text_2" />

<android.support.design.widget.TabItem
android:id=”@+id/tabItem3″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”@string/tab_text_3″ />

<android.support.design.widget.TabItem
android:id=”@+id/tabItem4″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”@string/tab_text_4″ />

</android.support.design.widget.TabLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>



Kodumuzu inceleyecek olursak; TabLayout’ un içine tab item’ları tanımlıyoruz. Burada tanımladığımız item’lar kadar sayfa arasında swipe işlemini gerçekleştirilir. Burada biz sadece item’a text özelliğini verdik ama istersek burada ikon da ayarlayabiliriz.

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

About Kübra Hebeş

Bilgisayar Mühendisi

13 comments

  1. You need to be a part of a contest for one of the greatest sites on the internet. I most certainly will highly recommend this web site!|

  2. Fastidious respond in return of this matter with genuine arguments and describing all about that.|

  3. Terrific post but I was wondering if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit more. Thank you!|

  4. Thanks for the good writeup. It if truth be told was a entertainment account it. Look complex to far brought agreeable from you! By the way, how can we keep up a correspondence?|

  5. Hi just wanted to give you a quick heads up and let you know a few of the images aren’t loading correctly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.|

  6. I think the admin of this site is actually working hard in support of his web site, for the reason that here every material is quality based data.|

  7. Pretty! This has been a really wonderful post. Many thanks for providing this info.|

  8. An outstanding share! I have just forwarded this onto a colleague who was conducting a little homework on this. And he in fact ordered me dinner simply because I stumbled upon it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to discuss this topic here on your blog.|

  9. Hi there, You’ve done an incredible job. I’ll definitely digg it and personally recommend to my friends. I am sure they will be benefited from this website.|

  10. Your means of telling all in this article is in fact pleasant, every one be capable of without difficulty be aware of it, Thanks a lot.|

  11. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers|

  12. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an e-mail. I’ve got some ideas for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it develop over time.|

  13. It’s really a nice and helpful piece of info. I am glad that you just shared this useful info with us. Please keep us informed like this. Thanks for sharing.|

Leave a Reply

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