android-tablayout

Navigation Drawer and VideoView in android

霸气de小男生 提交于 2019-12-06 17:10:59
问题 I am using a navigation drawer plus a tablayout. I have a video in my tab which was not visible at first, but I can hear the sound. Once I set video_view.setZOrderOnTop(true); and I can also see the video, but this causes an issue with navigation drawer. When I slide it, the video doesn't hide behind the navigation drawer as do all other elements. If I don't use video_view.setZOrderOnTop(true); then my drawer is works fine. main_activity.xml <android.support.v4.widget.DrawerLayout xmlns

Different sized tabs with TabLayout android

廉价感情. 提交于 2019-12-06 10:42:07
Trying to recreate same top TabLayout as Instagram. Main tab: Side tabs: Have tried multiple things: app:tabMode="fixed" app:tabMode="scrollable" I managed to create this programmatically like so: View view1 = getLayoutInflater().inflate(R.layout.customtab, null); view1.findViewById(R.id.icon).setBackgroundResource(R.drawable.my1); tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); View view2 = getLayoutInflater().inflate(R.layout.customtab, null); view2.findViewById(R.id.icon).setBackgroundResource(R.drawable.my2); tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); View view3

ViewPager addOnPageChangeListener not working on same tabClick

别说谁变了你拦得住时间么 提交于 2019-12-06 07:42:33
问题 I have a ViewPager with addOnPageChangeListener . ViewPager has 3 tabviews (tab1, tab2, tab3). When a user clicks tab2, it loads some data (Basically it a RecyclerView ). At this moment, if user again clicks tab2, I need to reload the data but in this case addOnPageChangeListener is not triggered. My Code: customPagerAdapter = new CustomPagerAdapter(getSupportFragmentManager(), MainActivity.this); viewPager.setAdapter(customPagerAdapter); viewPager.addOnPageChangeListener(new ViewPager

TabLayout using activities instead of fragments

回眸只為那壹抹淺笑 提交于 2019-12-06 02:49:28
问题 Is it possible to create a swiped TabLayout in an app using multiple activities instead of fragments? I have two activities using which I am trying to create an app that uses a swipable TabLayout. I am searching the net over this but could not find one yet. If that is possible to build, can anyone please provide some links or tutorials over this? 回答1: From GestureDetector and OnSwipeTouchListener: public class MainActivity extends Activity { private GestureDetectorCompat mDetector; @Override

How to implement android TabLayout design support libarary with Swipe views

好久不见. 提交于 2019-12-06 02:47:23
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().setText("Tab 3")); A bit late to the party, but to do that you have to use ViewPager class and use fragments

Android how to hide tab from TabLayout

人盡茶涼 提交于 2019-12-06 01:37:14
问题 I need to hide first tab. First page should work but when user select it, it should be seems like on tabs is selected. How I can do this? I found some solutions with TabHost and it useless to me. public class TabFragmentClients extends Fragment { public static TabLayout tabLayout; public static ViewPager viewPager; public static int int_items = 5 ; FinanceClients FinanceClients; public ClientsFragment clientsFragment; public FinanceFragment financeFragment; @Nullable @Override public View

How to fit the tab width screen in android

我与影子孤独终老i 提交于 2019-12-05 21:41:14
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="wrap_content" app:tabMode="scrollable" /> <android.support.v4.view.ViewPager android:id="@+id/viewpager"

How to set Tab width in Tab layout?

*爱你&永不变心* 提交于 2019-12-05 13:24:41
问题 I'm trying to create a tab layout which has two tabs . When I run the app on small mobile the tab layout looks fine but when I run the same application on Tablet it shows like this. It looks like this on Tablet: I want each tab to occupy entire space without any gaps on both the ends. I have created tab layout like this... private void drawTabLayout() { tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.addTab(tabLayout.newTab().setText("Imprint") ); tabLayout.addTab(tabLayout.newTab(

Failed to Load fragments when tabs + viewpager inside scrollview ?

旧街凉风 提交于 2019-12-05 13:10:24
using material design tablayout +viewpager material design tablayout everything works perfectly but if i m trying to put parent view as ScrollView so that my whole screen can scroll once user try to see tabs fragment content as fragment contains listview so it is getting very low height on small devices.After adding scrollview my fragments of viewpager are not being displayed ?how to overcome in this situation ? <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width=

ViewPager with Toolbar and TabLayout has wrong height

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 12:48:59
问题 I have a ViewPager below an AppBarLayout (with a Toolbar and a TabLayout). I cannot understand why the height of the loaded fragments is more than the available space, even if there are no elements so big, making the tab scrollable. This is the main layout xml: <android.support.design.widget.CoordinatorLayout 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"