2017-04-03 6 views
0

私のアプリにこれらのタブを広げようとしています。私は周りを見回しましたが、私はそれについて何も見つけることができません。AppBarのタブを広げるにはどうすればいいですか?

The tabs.

私が欲しいのは真ん中に正しい方法とTAB2に、左側にあることをTAB3 Tab1をです。

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent"> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabMode="scrollable"> 

     <android.support.design.widget.TabItem 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:text="Tab1" /> 

     <android.support.design.widget.TabItem 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:text="Tab2" /> 

     <android.support.design.widget.TabItem 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:text="Tab3" /> 
    </android.support.design.widget.TabLayout> 
</android.support.design.widget.AppBarLayout> 

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior"> 

    <android.support.constraint.ConstraintLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:context="com.master.moonbot.MoonBot"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hello World!" 
      app:layout_constraintBottom_toBottomOf="parent" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toTopOf="parent" /> 

    </android.support.constraint.ConstraintLayout> 
</android.support.v4.widget.NestedScrollView> 
</android.support.design.widget.CoordinatorLayout> 
+0

レイアウトXMLコードを投稿できますか? –

+0

[レイアウトXML](https://hastebin.com/zobamumowi.xml)done – KuanHulio

+0

残念ながら、私はhastebinに投稿する必要があります。 – KuanHulio

答えて

0

削除アプリ:tabMode = "スクロール可能"で、デフォルトでは固定になります。

<android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 
関連する問題