• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Android Tabs with Navigation Drawer

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the App design with Android Navigation Drawer and the list in Navigation Drawer like ( Home, Pics, Videos ) and each one of the list have own Fragment when I tap on home it will open Home Fragment and so on.
Now it's possible to make Android Tabs just with Videos,

How to achieve that?

Any Idea, please
 
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not clear on what you're asking - what, exactly, do you mean by "Android tabs"? Are you familiar with ViewPagers?
 
Muhannd Dhahier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes this is what I meant ... How can I implement that just for one Fragment, Home and Pics frag. will not have any tabs
 
Tim Moores
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused - you want "Android tabs" which "will not have any tabs"?

The views in a ViewPager don't need to be identical - your class that implements FragmentPagerAdapter can return whatever fragment you want to display from its getItem method.
 
Muhannd Dhahier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue not with views or viewpager , I am talking from the being.

If you have an activity then in the layout for this activity will use

<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.support.v7.widget.Toolbar
       android:id="@+id/toolbar"
       android:layout_width="match_parent"
       android:layout_height="?attr/actionBarSize"
       android:background="?attr/colorPrimary"
       app:layout_scrollFlags="scroll|enterAlways"
       app:popupTheme="@style/AppTheme.PopupOverlay">

   </android.support.v7.widget.Toolbar>

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

</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"/>

and no issue here, but If I am using  Android Navigation, for each item I am using (Fragment) to display the content for each element, so Do I need to put the
ViewPager and TabLayout in the fragment that I want to have the Tabs, but as we know each tab will call another fragment like for Tab1 we need to create frgTab1 and so on for Tab2, this is my issue, I used the Fragment to showing the Tabs is that correct or not ?
 
Tim Moores
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using both a TabLayout and a ViewPager? These days ViewPagers do what in earlier days TabLayout would have been used for - unless I fundamentally misunderstand what you're trying to accomplish, you would use either one of the other, but not both.
 
Muhannd Dhahier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok any tutorial for how using TabLayout inside a Fragment;

Thank you for responding
 
Tim Moores
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said before, TabLayout is obsolete; use a Viewpager instead.

Using either in a fragment isn't different from using any other layout; what particular difficulty are you facing?
 
Muhannd Dhahier
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most of the tutorials using TabLayout and ViewPager, chek this tutorial:

http://www.voidynullness.net/blog/2015/08/16/android-tablayout-design-support-library-tutorial/

So why you tell me to use only one of them?



What I need to achieve something like in this link:

http://stackoverflow.com/questions/31641979/using-tablayout-inside-a-fragment-tab-text-invisible

 
Tim Moores
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can combine just about any view/layout with just any other view/layout, but that doesn't mean it's necessarily a good idea. The way to indicate where you are in a Viewpager is a Viewpager indicator like PagerSlidingTabStrip.
 
reply
    Bookmark Topic Watch Topic
  • New Topic