android-tablayout

Android - Remove shadow between Toolbar and TabLayout

瘦欲@ 提交于 2019-11-30 07:18:34
I'm trying to make a layout with CollapsingToolbarLayout . But I do not get one thing. I want to remove the shadow between Toolbar and TabLayout . I've tried several ways and I have not managed to remove the shadow. Can anybody help me? Thank you <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:fitsSystemWindows

Cannot remove Padding from Tabs when using Custom views with Tab Layout

拜拜、爱过 提交于 2019-11-30 06:53:24
问题 I have added a Relative Layout in Custom View and have added this in Tab Layout. I am using a white background for tabs and have not applied any padding in tabs custom layout. But then also I am getting padding on tabs due to which I am shown some grey background within tabs as if android is internally applying padding to tabs. I am trying to display three text views which I am able to do but one of them is truncating because of padding applied to tabs. Also I want to have consistent

How is TabItem used when placed in the layout XML?

扶醉桌前 提交于 2019-11-30 05:55:06
The TabLayout documentation gives an example of nesting TabItem directly inside TabLayout like so: <android.support.design.widget.TabLayout android:layout_height="wrap_content" android:layout_width="match_parent"> <android.support.design.widget.TabItem android:text="@string/tab_text"/> <android.support.design.widget.TabItem android:icon="@drawable/ic_android"/> </android.support.design.widget.TabLayout> But it gives no example of how this could be used in practice, and the documentation for TabItem says: This view is not actually added to TabLayout, it is just a dummy which allows setting of a

Android TabLayout custom indicator width

拟墨画扇 提交于 2019-11-30 05:41:39
I want to reduce width of indicator - for example, make it's width not whole tab width, but 1/2 of tab width. That's all I need to do, so I don't want to download some custom library and search where I can do this. Is it a way to do this or I should write such view by myself? Try this. public void setIndicator (TabLayout tabs,int leftDip,int rightDip){ Class<?> tabLayout = tabs.getClass(); Field tabStrip = null; try { tabStrip = tabLayout.getDeclaredField("mTabStrip"); } catch (NoSuchFieldException e) { e.printStackTrace(); } tabStrip.setAccessible(true); LinearLayout llTab = null; try { llTab

Fragment in TabLayout only load when user slide Android

两盒软妹~` 提交于 2019-11-30 04:55:28
问题 Hi I'm making an app with A fragment and few child fragment inside it using tablayout and viewpager . The problem is all my child fragment (from Tablayout ) always execute (load all the code inside whenever user click the parent fragment . How to get the child fragment only load whenever the the user slide to it (for example I have 2 tab, content in tab 2 only load when user slide to tab 2) Here is my parent fragment code public class ManageEventFragment extends Fragment { public

Remove highlight on press in tablayout

我是研究僧i 提交于 2019-11-30 04:44:00
问题 How to disable this highlight on pressing the tab. I have been searching for half an hour and couldn't figure it out. I am using tablayout. 回答1: just set the background color to transparent or to the background color of the tablayout. Add the following code to the parent layout. xmlns:app="http://schemas.android.com/apk/res-auto" And add the following to tablayout. app:tabBackground="?attr/colorPrimary" android:background="?attr/colorPrimary" This will solve your problem. Tested in Android M.

Android: pin TabLayout to top of Scrollview

妖精的绣舞 提交于 2019-11-30 00:14:07
I was looking at the twitter app on my phone. You can see that when a user scrolls up, the tabLayout actually just pins itself onto the bottom of the toolbar nicely and does not move at all. I thought maybe they did it by just putting all of the top part of the app (the profile picture, the profile wallpaper of the bicycle on the grass, the text), into a CollapsingToolBarLayout and AppBarLayout but actually, only the profile wallpaper with the bicycle on the grass is part of the CollapsingToolBarLayout and AppBarLayout as that is the only part that actually collapses. The text part just

Changing TabLayout icons on left, top, right or bottom in com.android.support:design:23.1.0

别等时光非礼了梦想. 提交于 2019-11-29 21:36:57
I'm pretty new to android development. So bear with me. I've been trying to align the icon and text in same line in com.android.support:design:23.1.0 for a day. Apparently in com.android.support:design: 23.1.0 they've changed the default icon position to top and text on the bottom. Previously in com.android.support:design: 23.0.1 the default was the icon on left and text in same line as the icon So here's an easy way to solve it (though it might have drawbacks, idk tbh): change the version in your app's build.gradle. ex: 23.1.0 to 23.0.1 and build. And there's a better way to do it (this way

Solved - Android ViewPager and TabLayout are not working fast

梦想的初衷 提交于 2019-11-29 11:01:07
问题 There are nested fragments with TabLayout and ViewPager . Each fragment has listview inside it so they get call together and now I'm getting an issue of slow processing of app. I have tried some solutions like volley library but it didn't work for me. For more I'm posting my code too so please guide me to make it best. MainTabFragment.java public class MainTabFragment extends Fragment { public static int position_child_tab = 0, three_childs_tab_position = 0; static int count = -1; int

TabLayout with viewpager not smooth scrolling

我与影子孤独终老i 提交于 2019-11-29 10:38:57
问题 Edit I have followed these tutorials to fix this problem. http://www.truiton.com/2015/06/android-tabs-example-fragments-viewpager/ https://guides.codepath.com/android/google-play-style-tabs-using-tablayout http://www.voidynullness.net/blog/2015/08/16/android-tablayout-design-support-library-tutorial/ But its annoying that problem still persists after trying several solutions. Here is demo for the problem i am facing.Its been weeks since i am stuck on this problem. Link for demo. Devices i am