android - Adding SlidingTab inside tab -


i using library sliding tabsmarttablayout - ogaclejapan. want add 1 more sliding tab inside 1 tab of parent sliding tab. when can't see second sliding tab.

refer imagefirst parent sliding tab. , in 'trains' adding same sliding tab

here mainactivity contains parent sliding tab.

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin"  android:id="@+id/root" tools:context="com.virtualsquadz.letsgo.mainactivity"> <relativelayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_alignparenttop="true"     android:id="@+id/topbar"     android:layout_margintop="@dimen/_16sdp"     android:paddingbottom="@dimen/_5sdp">     <imagebutton         android:layout_width="wrap_content"         android:id="@+id/backbutton"         android:layout_height="wrap_content"         android:src="@drawable/back_0"         android:background="@null"         android:layout_alignparentleft="true"         />     <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/title_transport"         android:text="getting around"         style="@style/title_transport"         android:paddingtop="@dimen/_2sdp"         android:layout_centerinparent="false"         android:layout_centerhorizontal="true"         />  </relativelayout> <com.ogaclejapan.smarttablayout.smarttablayout     android:id="@+id/viewpagertab"     android:layout_below="@id/topbar"     android:layout_width="match_parent"     android:layout_height="48dp"     app:stl_indicatoralwaysincenter="false"     app:stl_indicatorwithoutpadding="false"     app:stl_indicatorinfront="false"     app:stl_indicatorinterpolation="smart"     app:stl_indicatorgravity="bottom"     app:stl_indicatorcolor="#40c4ff"     app:stl_indicatorthickness="4dp"     app:stl_indicatorwidth="auto"     app:stl_indicatorcornerradius="2dp"     app:stl_overlinecolor="#4d000000"     app:stl_overlinethickness="0dp"     app:stl_underlinecolor="#4d000000"     app:stl_underlinethickness="1dp"     app:stl_dividercolor="#4d000000"     app:stl_dividerthickness="1dp"     app:stl_defaulttabbackground="?attr/selectableitembackground"     app:stl_defaulttabtextallcaps="true"     app:stl_defaulttabtextcolor="@color/flight_white"     app:stl_defaulttabtextsize="@dimen/_12sdp"     app:stl_defaulttabtexthorizontalpadding="@dimen/_16sdp"     app:stl_defaulttabtextminwidth="0dp"     app:stl_distributeevenly="true"     app:stl_clickable="true"     app:stl_titleoffset="24dp"     app:stl_drawdecorationaftertab="false"     />  <android.support.v4.view.viewpager     android:id="@+id/viewpager"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_below="@id/viewpagertab"     android:layout_margintop="@dimen/_5sdp"     />   </relativelayout> 

mainactivity.java

smarttablayout viewpagertab = (smarttablayout)      findviewbyid(r.id.viewpagertab);     viewpager viewpager=(viewpager)findviewbyid(r.id.viewpager) ;      viewpageritemadapter adapter = new viewpageritemadapter(viewpageritems.with(this)             .add(r.string.transportoption1, r.layout.activity_flights)             .add(r.string.transportoption2, r.layout.activity_train)             .add(r.string.transportoption3, r.layout.activity_buses)             .add(r.string.transportoption4, r.layout.activity_cars)             .create());      viewpager.setadapter(adapter);     viewpagertab.setviewpager(viewpager); 

similary designed 'trains' inside train.java

smarttablayout viewpagertab = (smarttablayout) findviewbyid(r.id.viewpagertab2);     viewpager viewpager=(viewpager)findviewbyid(r.id.viewpager2) ;      viewpageritemadapter adapter = new viewpageritemadapter(viewpageritems.with(this)             .add(r.string.trainsearchoption1, r.layout.trainsearchoption1)             .add(r.string.trainsearchoption2, r.layout.trainsearchoption2)             .create());      viewpager.setadapter(adapter);     viewpagertab.setviewpager(viewpager); 

i tried find solution here. unfortunately couldn't find answer. if wondering viewpager should called if nested take situation example - first child view pager called when swipping left / right , when @ extreme end of left / right respectively of child view pager parent view pager called. or can click on tabs of parent change it.

google material design guidelines doesn't allow using nested tabs. bad programming practice.

it highly recommend modify ui conform google design guidelines.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -