Questions tagged [android-tablayout]

Android TabLayout provides a layout to organize pages of information.

TabLayout provides a horizontal layout to display tabs.

Population of the tabs to display is done through TabLayout.Tab instances. You create tabs via newTab(). From there you can change the tab's label or icon via setText(int) and setIcon(int) respectively. To display the tab, you need to add it to the layout via one of the addTab(Tab) methods.

Useful links

2044 questions
0
votes
3 answers

Set tab view position from other Fragment, if tab view is hosted in Fragment instead of Activity

I have ActivityTwo in my application.When ActivityTwo is opened I am replacing its layout with a new fragment which has 3 Tabs set using Viewpager. This is code in ActivityTwo onCreate for calling the Fragment instantly when ActivityTwo is opened.…
0
votes
2 answers

TabLayout always shows the last fragment

I am trying to fill Tablayout from 2 different fragments depending on the value (0 or 1) of the argument Radios.newInstance(int type) The first fragment contains all radio stations and the second contains the favorite stations But it shows me…
0
votes
2 answers

Android TabLayout prevent activation of tabs adjacent to selected

I have a tab-based app. I am using A TabLayout for my tabs and a subclass of FragmentStatePagerAdapter to instantiate the fragment for the selected tab. I have disabled swiping between tabs. I am still seeing a callback to create a fragment for tabs…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
0
votes
1 answer

How can I modify this design on android? Can I put icon left side of other tab items?

Is there anyone to help me with making this design with tab layout on the android studio? Can I put icon left side of other tab items? enter image description here
0
votes
1 answer

Move the tabs at the bottom of the screen

Hi I have to move a tablayout on Android at the bottom of the screen, I tried some solutions on this forum, by applying the Fragments present in the tablayout are no longer visible! How can I move the TabLayout down and keep the fragments…
riki
  • 1,502
  • 5
  • 17
  • 45
0
votes
0 answers

Adding Icons to Tabs in TableLayout Using Kotlin

I am having trouble in adapter line no 3 after updating android studio version. The same code worked for previous version, but now it is giving an error in the adapter. val fragmentAdapter= MyPagerAdapter(supportFragmentManager) val…
Tayyab Ali
  • 71
  • 1
  • 12
0
votes
1 answer

android fragment does not show in view pager

I have an application. I use in Main activity tab layout with view pager. I tried to load a fragment in every 3 tab in my view pager.but my fragment does not show in view pager.I did it before several times but now it does not work!! I dont know…
john
  • 345
  • 1
  • 4
  • 20
0
votes
1 answer

add border around tabs in android

I am adding the border around tabs as shown in the second image. I am able to add the borders on top and the bottom as shown in first image but not able to add the border on left/right side of each tab individually. main_activity.xml …
Nouman
  • 122
  • 2
  • 11
0
votes
2 answers

How to use getChildFragmentManager with a class that extends Dialog fragment

I am a having a fragment with TabLayout. As soon as I move from TabLayout Fragment to the next Fragment and press the back key. The content on the default TabLayout fragment disappears. I found a possible solution to this in the post. Following is…
0
votes
1 answer

how to animate to 2nd tab when 1st tab recyclerview item is clicked from adapter?

I have been looking for a solution past 2 days and yet no solution worked. So I had to use Intent to restart the activity when item of recyclerview is clicked. Below is the code: holder.itemView.setOnClickListener(new View.OnClickListener() { …
0
votes
2 answers

How to update tab title from Adapter?

I have an Activity inside the activity I have tab layout with two tabs(tab 1, tab 2). Each tab have recyclerview with list of items using Recycleradapter. I want to change the tab title when the user is clicking the recycler child item. FYI :- I…
Krishna
  • 4,892
  • 18
  • 63
  • 98
0
votes
2 answers

findViewByID not work in tab layout

i use tab layout matching this tutorial: tab layout tutorial androidhive It works fine, but when I add a button to fragment_one.xml , i cant use setOnClickListener for this button Because findViewById not work in MainActivity.java the MainActivity…
0
votes
0 answers

Customized TabLayout in Android

I am trying to build a custom TabLayout as part of a library, which can be used by other apps. Each Tab inside this Tablayout also needs to have a custom background, attributes. public class MyTab extends TabLayout { Context mContext; …
Arghya Pal
  • 133
  • 1
  • 9
0
votes
1 answer

Android: how to disable default pop TabLayout animation on tab selection

So, is there a way to disable animation when a tab is selected? I'd like to remove shadow/elevation. The idea is to keep it simple. Here is my layout app bar code:
Jeavie
  • 212
  • 4
  • 16
0
votes
1 answer

Set Icon with Text in a Tabbed Activity

I'm trying to implement a icons with text in my tabbed-activity. I don't understand how to visualize the icons. this is the code: tab_layout.xml:
KKKKK
  • 273
  • 2
  • 18