android-tablayout

Add button on Sliding Tab Layout

╄→гoц情女王★ 提交于 2019-12-23 05:05:28
问题 I want to add a custom button on my Tab Layout. This expand button will expand my current tab view. I already have implemented all the functionalities given in google's sliding tab. 回答1: You can make it with the help of FrameLayout. <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match

How to disable viewpager when navigation drawer is open

荒凉一梦 提交于 2019-12-23 05:04:37
问题 I have written a simple code with navigation drawer and 3 fixed tabs but i facing these two bugs 1> Even when the navigation drawer is open and when i click on it... The tabs which are present at the same spot hidden behind the navigation drawer get clicked as well. 2> When i click the items on navigation drawer... the action get performed but the fragment is not replaced or more precisely hidden by the viewpager. Here are the codes.. MainActivity.java public class MainActivity extends

addOnPageChangeListener is undefined

穿精又带淫゛_ 提交于 2019-12-23 01:04:41
问题 I have downloaded a code from Github.I can not run the program.The problem is the method addOnPageChangeListener is undefined.Here's the error: The method addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener) is undefined for the type ViewPager What should i do? Should I use another method? Here's the code: import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton;

addOnPageChangeListener is undefined

大兔子大兔子 提交于 2019-12-23 01:04:26
问题 I have downloaded a code from Github.I can not run the program.The problem is the method addOnPageChangeListener is undefined.Here's the error: The method addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener) is undefined for the type ViewPager What should i do? Should I use another method? Here's the code: import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton;

Android, TabLayout icon color doesn't change when dragging

早过忘川 提交于 2019-12-22 18:23:16
问题 So, I have code like this: tabLayout.setOnTabSelectedListener( new TabLayout.ViewPagerOnTabSelectedListener(tabViewPager) { @Override public void onTabSelected(TabLayout.Tab tab) { super.onTabSelected(tab); //set selected icon color Drawable icon = tab.getIcon(); icon = DrawableCompat.wrap(icon); DrawableCompat.setTint(icon, ContextCompat.getColor(MainActivity.this, R.color.colorAccent)); tab.setIcon(icon); } @Override public void onTabUnselected(TabLayout.Tab tab) { super.onTabUnselected(tab

Change ViewPager Fragment From Child Fragment

你说的曾经没有我的故事 提交于 2019-12-22 07:36:24
问题 I have a ViewPager using a TabLayout with several fragments. I would like to click a button from one of the ViewPager fragments and direct the user to another tab/fragment using the tab name. When the button is clicked, I would like the TabLayout to change as well as show the fragment associated to that tab. I would also need to send additional data with the request to show on the new fragment. I don't have access to the ViewPager setCurrentItem(int index). Ideally I would like to communicate

Layout fields of fragment are NULL on initialization

↘锁芯ラ 提交于 2019-12-22 06:09:57
问题 I have issue with passing data to fragments. It crashes 0.1% of all times on production. Let's say on 100k opening of activity it happens 100 times. It looks like not very often, but it very bothering me and I think that I am doing something wrong with fragments initialization with data. The thing is, that I create fragments only one time, and all other times I need to pass data to them I am doing it next way: myFragmentInstance.setData(Object someData); And crash happens because it tells

Tablayout with Custom view Broken on 23.4.0 design lib

六月ゝ 毕业季﹏ 提交于 2019-12-22 04:59:13
问题 i am setting tablayout to my viewpager . but when i use notifyDataSetChanged then it removing my customview and showing default title view my code ViewPager viewPager = findView(R.id.view_pager); ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), getResources(), getFragments()); viewPager.setAdapter(adapter); tabs.setupWithViewPager(viewPager); for (int i = 0; i < tabs.getTabCount(); i++) { TabLayout.Tab tab = tabs.getTabAt(i); tab.setCustomView(getTabView(i)); } t

Why is Tablayout and Viewpager crashing with NullpointerException when I start a fragment with LoaderManager from TabFragment?

依然范特西╮ 提交于 2019-12-21 17:45:28
问题 I am following the tutorial of https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library/ to implement sliding tablayout. It works perfect for empty fragments, However, I have 3 fragments with LoaderManagers and recyclerViews, each one loads different data. When the app loaded at the first time, if I click from the first fragment to the third fragment on the tabLayout without sliding or clicking to second one, it crashes. The data was not loading, as it

TabLayout inside Toolbar

醉酒当歌 提交于 2019-12-21 07:57:29
问题 I want to achieve a certain look with the new Design Support Library and I can't stop seeing a weird bug. Here's the screencast with the desired output (not done with DSL) And the ouput I get using DSL . The toolbar+tabs is in an activity with a viewpager, and the recyclerView is inside a fragment within the viewpager (the adapter actually, but you get my point) Code for the activity : <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"