android-tablayout

Android Studio, Trying to hide TabLayout, StatusBar, SupportActionBar and an unknown bar?

廉价感情. 提交于 2019-12-01 12:23:10
问题 So at the click of a button I want to hide all bars on top of screen, to disappear. At another click of button I want them all to reappear again. I successfully did that and have the following bars to hide on button click: Status Bar, TabLayout tab fragments, Support Action Bar. Here's what I have. When I click my "Start" button ^, all these bars on top, hide. But only 1 is left ... I tried hiding the "getActionBar" but that bar that's left is not it. According to my styles.xml when I change

How to create dynamic tabs and add different functionality to each fragment in Android?

泄露秘密 提交于 2019-12-01 12:03:03
问题 I knew how to create static Tabs, work with a volley to get data in android and work in each fragment but how to create dynamic tabs using JSON and store different details on each of tabs . Like first tab store "मुख्य समाचार" images and details which are coming from different web service. What I know is to create tabs like this: public class TabActivity extends AppCompatActivity { private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; @Override protected void

Android: How to change android:fillcolor with selector in one Vector Drawable xml

浪子不回头ぞ 提交于 2019-12-01 04:25:49
Tab Icons: My current method is to create two files (ic_list_selected_24dp.xml and ic_list_unselected_24dp.xml; they are basically the same but only the android:fillColor='Color HEX CODE' are different), and then create a selector (selector_tabitem_list.xml) to change the drawable color when the state is changed. // @drawable/selector_tabitem_list.xml <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:drawable="@drawable/ic_list_selected_24dp" android:state_selected="true" /> <item android:drawable="@drawable

How to set icon next to text in tablayout

你说的曾经没有我的故事 提交于 2019-12-01 04:02:00
I am working on Tablayout with text and icon from the following tutorial .. My question is how to make the icon placed next to the text instead of above them? I am new in Android Development, hopefully you guys can help me out. Thank you in advance, really appreciate the answer.. Here is my java file public class AllProducts extends AppCompatActivity { public ViewPager viewPager; public TabLayout tabLayout; public int[] tabIcons = { R.drawable.ic_directions_car_white_24dp, R.drawable.ic_motorcycle_white_24dp, R.drawable.ic_build_white_24dp }; @Override protected void onCreate(Bundle

TabLayout selected tab gravity

时间秒杀一切 提交于 2019-12-01 03:15:39
TabLayout is set up with ViewPager , has a lot of tabs, MODE_SCROLLABLE and keyline app:tabContentStart="72dp" . When user selects a tab, TabLayout tries to scroll the selected tab to the center. I would like the selected tab to be left aligned to keyline, not centered. Is it possible? Android Design Support Library v22.2.0. Unfortunately the method calculateScrollXForTab() of TabLayout is private and then not replaceable by subclasses. Either way you can copy the source TabLayout in your project, then possibly extending it with your class, and change the method calculateScrollXForTab() like

TabLayout selected Tab icon is not selected on start up

爱⌒轻易说出口 提交于 2019-12-01 03:14:57
I'm using a TabLayout for Tabbed navigation in my app. I have a really weird issue with it, I have created 4 tabs using this code: private int[] tabIcons = {R.drawable.navigation_timeline_icon_selector, R.drawable.navigation_feed_icon_selector, R.drawable.navigation_messages_icon_selector, R.drawable.navigation_notification_icon_selector}; TabLayout tabLayout = setTabLayout(); if (tabLayout != null) { for (int i = 0; i < 4; i++) { tabLayout.getTabAt(i).setIcon(tabIcons[i]); } } Each of the items in tabIcon is a selector with selected and non-selected states. All icon selectors are configured

How to use TabLayout with ViewPager2 in Android

十年热恋 提交于 2019-12-01 03:04:35
I want to use com.google.android.material.tabs.TabLayout component with Android's new ViewPager implementation androidx.viewpager2.widget.ViewPager2 . However, the setupWithViewPager(..) method provided by TabLayout supports only the old ViewPager implementation. Is there a way to bind a TabLayout to a ViewPager2 component easily? You have to use this TabLayoutMediator that mimics tabLayout.setupWithViewPager() and sets up the ViewPager2 with Tablayout . Otherwise you will have to write your own adapter that will combine both parties. Initialize the TabLayoutMediator object with an object of

android.support.design.widget.TabLayout select Tab Programmatically

我是研究僧i 提交于 2019-12-01 02:13:36
I am using android.support.design.widget.TabLayout. It has two tabs, If user selects second tab On particular condition I want user to redirect to first tab and disallow him to go to sencond tab until condition matches. To achieve this I tried, tabLayout.getTabAt(0).select(); but it does not reselect first tab This is because that view is still not initialized properly, and you are trying to perform some action. As a solution you just need to put one hadler before selecting perticular tab . new Handler().postDelayed( new Runnable(){ @Override public void run() { tabLayout.getTabAt(yourTabIndex

Hide Tablayout Bar in android

和自甴很熟 提交于 2019-11-30 23:54:20
I have a activity with toolbar , Tablayout , viewpager with fragments like that I want to implement toolbar material search on all the fragments like that but the problem is TAB Bar . I want to hide the tab bar(Call,Chat,Contact) on Search Open and unhide it when the search close How can I hide the tabbar ? I am using this library for material Search view implementation layout code is below <?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

TabLayout selected tab gravity

有些话、适合烂在心里 提交于 2019-11-30 22:38:20
问题 TabLayout is set up with ViewPager , has a lot of tabs, MODE_SCROLLABLE and keyline app:tabContentStart="72dp" . When user selects a tab, TabLayout tries to scroll the selected tab to the center. I would like the selected tab to be left aligned to keyline, not centered. Is it possible? Android Design Support Library v22.2.0. 回答1: Unfortunately the method calculateScrollXForTab() of TabLayout is private and then not replaceable by subclasses. Either way you can copy the source TabLayout in