久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

TabLayout 中的選項卡沒有填滿整個 ActionBar

Tabs in TabLayout not filling up entire ActionBar(TabLayout 中的選項卡沒有填滿整個 ActionBar)
本文介紹了TabLayout 中的選項卡沒有填滿整個 ActionBar的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在使用 TabLayoutViewPager 按照指南 .

GRAVITY_CENTER 用于在 TabLayout 的中心布置選項卡的重力.

GRAVITY_FILL 用于盡可能多地填充 TabLayout 的重力.

MODE_FIXED 固定選項卡同時顯示所有選項卡,最適合用于受益于選項卡之間快速旋轉的內容.

MODE_SCROLLABLE 可滾動標簽在任何給定時刻顯示標簽的子集,并且可以包含更長的標簽標簽和更多的標簽.

在您的代碼或布局 xml 中設置它.

app:tabGravity="center"應用程序:tabMode =固定"

tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);tabLayout.setTabMode(TabLayout.MODE_FIXED);

一般情況下,使用像blow這樣的代碼可以不用設置tabGravitytabMode.

I am using a TabLayout and ViewPager to display ActionBar tabs following the guide Google Play Style Tabs using TabLayout, however my tabs are squished to the left side of the ActionBar, shown below:


And I would like them to take up the whole bar with equal widths. I've made only a few minor changes to the guide:

In activity_main.xml a style was created to show the ActionBar:

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

Here is the styles.xml code:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <item name="windowActionBar">true</item>
  <item name="tabIndicatorColor">#ffff0030</item>
</style>

Also, my MainActivity now extends AppCompatActivity instead of a FragmentActivity.

解決方案

You can refer to the TabLayout.

GRAVITY_CENTER Gravity used to lay out the tabs in the center of the TabLayout.

GRAVITY_FILL Gravity used to fill the TabLayout as much as possible.

MODE_FIXED Fixed tabs display all tabs concurrently and are best used with content that benefits from quick pivots between tabs.

MODE_SCROLLABLE Scrollable tabs display a subset of tabs at any given moment, and can contain longer tab labels and a larger number of tabs.

Set this in your code or your layout xml.

app:tabGravity="center"
app:tabMode="fixed"

or

tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
tabLayout.setTabMode(TabLayout.MODE_FIXED);    

Generally, using the code like blow can work without setting tabGravity and tabMode.

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_scrollFlags="scroll|enterAlways" />

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

</android.support.design.widget.AppBarLayout>

這篇關于TabLayout 中的選項卡沒有填滿整個 ActionBar的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 毛片综合| 日韩高清av | 国产精品成人69xxx免费视频 | 国产乱码精品一品二品 | 国产精品日韩欧美一区二区三区 | 在线观看国产www | 一区二区在线免费观看 | 日韩精品在线看 | 久久一久久 | 国产一区二区三区四区在线观看 | 91久久精品国产 | 国产精品久久久久久亚洲调教 | 午夜影院在线观看视频 | 91在线一区 | a在线v| 中文精品视频 | 国产视频久久 | 日本久久久久久 | 91xxx在线观看 | 最新中文字幕在线 | 日本又色又爽又黄又高潮 | 久久久国产精品视频 | 武道仙尊动漫在线观看 | 久久91 | 欧美性一区二区三区 | 黑人巨大精品欧美一区二区一视频 | 欧美成人猛片aaaaaaa | 国产精品亚洲一区 | 成人福利片 | 日本 欧美 国产 | 在线免费观看毛片 | 在线视频一区二区 | 国产丝袜一区二区三区免费视频 | 久久精品国产久精国产 | 一区二区三区视频在线免费观看 | 久久777| 综合网视频 | 亚洲日本中文字幕在线 | 日韩欧美在线播放 | 亚洲国产黄 | 日韩精品一区二区三区视频播放 |