6

Ich folgte this tutorial. Ich habe eine einfache Änderung gemacht, die TabLayout am unteren Bildschirmrand zeigt.Wie Registerkarte oben auf Registerkarten angezeigt wird

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<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.v4.view.ViewPager 
     android:id="@+id/viewpager_landing" 
     android:layout_width="match_parent" 
     android:layout_height="0px" 
     android:layout_weight="1" 
     android:background="@android:color/white" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/sliding_tabs_landing" 
     style="@style/MyCustomTabLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabMode="fixed" /> 

</LinearLayout> 

enter image description here

Problem: -

TabIndicator wird unten auf dem Bildschirm zeigt gut funktioniert, jetzt möchte ich zeigen, dass TabIndicator bei Top of Tabs eher als unten. Mit benutzerdefinierten Layout können wir tun, wie im Tutorial erwähnt, aber gibt es ein XML-Attribut, das TabIndicator oben angezeigt wird?

+0

Ihr XML-Code setzen. thx – Fakher

+0

@Fakher Ich habe xml gepostet –

+0

@Nilesh Hast du das erreicht? Ich möchte auch die Tab-Anzeige oben anzeigen. –

Antwort

0

Das ist für mich gearbeitet:

LinearLayout tabs = ((LinearLayout) tabLayout.getChildAt(0)); 

for (int position = 0; position < tabs.getChildCount(); position++) { 
    LinearLayout item = ((LinearLayout) tabs.getChildAt(position)); 
    item.setRotationX(180); 
} 
Verwandte Themen