6

私はthis tutorialの後に続きます。画面の一番下にTabLayoutという簡単な変更を加えました。タブの上にタブインジケータを表示する方法

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

問題: -

TabIndicatorではなく、今、私はタブの上部にTabIndicatorことを示したい、うまく機能して、画面の下部に表示されます底よりも。 カスタムレイアウトを使用すると、チュートリアルで述べたように行うことができますが、上部にTabIndicatorと表示されるxml属性はありますか?

+0

は、あなたのXMLコードを置きます。 thx – Fakher

+0

@Fakher xmlを投稿しました –

+0

@Nileshこれを達成しましたか?私はまた、上にタブインジケータを表示したい。 –

答えて

0

これは私の仕事:

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

for (int position = 0; position < tabs.getChildCount(); position++) { 
    LinearLayout item = ((LinearLayout) tabs.getChildAt(position)); 
    item.setRotationX(180); 
} 
関連する問題