android-tablayout

Android TabLayout tabPaddingTop and tabPaddingBottom not being removed

自古美人都是妖i 提交于 2019-12-10 19:01:49
问题 Here is my tab layout XML <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="@dimen/custom_tab_layout_height" android:background="@color/tab_background_primary" app:tabGravity="fill" app:tabIndicatorColor="@color/primary_white" app:tabIndicatorHeight="3dp" app:tabMinWidth="120dp" app:tabMode="scrollable" app:tabPaddingStart="-1dp" app:tabPaddingEnd="-1dp" app:tabPaddingTop="1dp" app:tabPaddingBottom="1dp" /> It is

Change tabs text color in TabLayout to different colors programmatically

 ̄綄美尐妖づ 提交于 2019-12-10 18:16:20
问题 I have 7 dates tabs in my screen, when tab selected, the text is black in color; while other select-able tabs are white in color. If the date falls on another month, I want the text color to be grey color. I assumed the first tab is 0, second tab is 1, and continues until 6. As in the picture, I want to change the text color of tab(3), tab(4), tab(5) and tab(6). How could it be done programmatically, when it meet required condition (not xml), to set the text color in these 4 tabs grey?

How to use tablayout with bottom navigation and viewpager?

给你一囗甜甜゛ 提交于 2019-12-10 17:19:22
问题 I created an activity with a bottom navigation bar . I want tablayout when I want to switch to another fragment. And tablayout can control viewpager . Can I put viewpager to the specified fragment? I wanna like this: This is the current result. I want to put viewpager in the red box. 回答1: Try this to sync your BottomNavigationView and TabLayout with ViewPager myBottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override

Add OnLongClickListener on android support TabLayout | TabLayout.Tab

試著忘記壹切 提交于 2019-12-10 15:59:53
问题 I am using the TabLayout found in the Service library. I have tried to add an OnLongClickListener when long-clicking on a tab. It has been impossible for me. I have even been trying to "hack" it by using childViews: View tabLayoutChild = tabLayout.getChildAt(0); ViewGroup group = (ViewGroup) tabLayoutChild; group.getChildAt(0).setOnLongClickListener(this); Doesn't work and does NOT look pretty. It is all very handy except for the longClick I want to implement. My small snippet of code

TabLayout header hides first item on a ListView in a fragment

穿精又带淫゛_ 提交于 2019-12-10 10:56:57
问题 i've got my Android skills a bit rusty, and i hope someone can help me with this. I've got a TabLayout with a ViewPager to swipe the same Fragment with different data in a ListView . Everything is working ok, but I've got a problem. The tabs header text hides a part of the Fragment , causing the first element of the ListView being hiden behind. I really have tried to find a solution for this problem but i couldn't, I'm sure it must be something simple but no solution. If you need more info,

How to implement android TabLayout design support libarary with Swipe views

纵然是瞬间 提交于 2019-12-10 10:27:37
问题 I am going to use android TabLayout design support library but i don't know how to use swipe view. Here is my Code XML: <android.support.design.widget.TabLayout android:id="@+id/tabLayout" android:layout_width="match_parent" android:layout_height="wrap_content"/> Java: TabLayout tabLayout; tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.addTab(tabLayout.newTab().setText("Tab 1")); tabLayout.addTab(tabLayout.newTab().setText("Tab 2")); tabLayout.addTab(tabLayout.newTab()

Android TabLayout selected tab background

泄露秘密 提交于 2019-12-10 09:59:09
问题 Is there really really no easy way to use a TabLayout and be able to set the colors of the tabs (selected, not selected)? Like the selected tab background uses colorPrimary , non selected tabs uses colorPrimaryDark or something? I've searched the web including this and this and much more. I can change the background color with solution 1 but now the indicator is missing and I want it back. This can't be so hard to do.. Solution of first link: <style name="Base.Widget.Design.TabLayout" parent=

How to fit the tab width screen in android

空扰寡人 提交于 2019-12-10 09:47:27
问题 I implement the tab layout using android support library and it looks like Here the tab width is not fit with screen and my layout is <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.TabLayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height=

How to make tab title alignment to left in TabLayout in Android

和自甴很熟 提交于 2019-12-10 03:31:40
问题 I can't seem to align my tab titles to the left, inside my TabLayout. At the moment, the titles are centered. Here is what I want to achieve. And this is what I have at the moment. The code I'm using is as follows: <android.support.design.widget.TabLayout android:id="@+id/tabs" app:tabGravity="fill" app:tabMode="fixed" app:tabTextColor="@color/white" app:tabSelectedTextColor="@color/white" app:tabIndicatorColor="@color/white" android:background="@color/slate_grey" android:layout_width="match

How to set current tab in viewpager with tablayout

Deadly 提交于 2019-12-09 08:04:15
问题 I have a custom viewpager (with swiping disabled for reasons) working with a tablayout. The content changes based on which tab is selected. I want to test this using espresso: 1) Click on a particular tab 2) Check some data in a particular page of the tab How can I do that. I am a novice to espresso 回答1: There are several ways of doing this, an easy one is to select the element by the tab title, I use this code: Matcher<View> matcher = allOf(withText("TAB TITLE"), isDescendantOfA(withId(R.id