6

Tôi đã theo dõi this tutorial. Tôi đã thực hiện thay đổi đơn giản hiển thị TabLayout ở cuối màn hình.Cách hiển thị chỉ báo tab ở trên cùng của Tab

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

Vấn đề: -

TabIndicator đang hiển thị ở phía dưới của màn hình làm việc tốt, Bây giờ tôi muốn chứng minh rằng TabIndicator tại Đầu Tabs khá hơn đáy. Sử dụng bố cục tùy chỉnh, chúng tôi có thể thực hiện điều đó như đã đề cập trong hướng dẫn nhưng có bất kỳ thuộc tính xml nào sẽ hiển thị TabIndicator ở trên cùng không?

+0

đặt mã xml của bạn. thx – Fakher

+0

@Fakher Tôi đã đăng xml –

+0

@Nilesh Bạn đã đạt được điều này? Tôi cũng muốn hiển thị chỉ báo tab ở trên cùng. –

Trả lời

0

này đã làm việc cho tôi:

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

for (int position = 0; position < tabs.getChildCount(); position++) { 
    LinearLayout item = ((LinearLayout) tabs.getChildAt(position)); 
    item.setRotationX(180); 
} 
Các vấn đề liên quan