久久久久久久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(使用線程逐塊處理文件)
主站蜘蛛池模板: 亚洲婷婷六月天 | 日韩网 | 男女视频在线观看 | 狠狠操狠狠干 | 成人三级视频在线观看 | 黄色毛片在线播放 | 天天久久| 国产91亚洲精品一区二区三区 | 欧美日韩精品免费 | 日韩精品在线免费观看 | 色综合美女 | 亚洲欧美日韩电影 | 日韩欧美二区 | 日韩成人高清在线 | www.成人久久 | www网站在线观看 | 青青操91| 九色.com| 日韩在线精品 | 超碰日韩 | 久久av资源网 | 一区二区三区观看视频 | 中文字幕一区二区三区精彩视频 | 亚洲在线日韩 | 国产午夜精品一区二区 | 国产乱码精品一区二区三区五月婷 | av网站在线免费观看 | 日韩电影中文字幕 | 91大神新作在线观看 | aaaaaaa片毛片免费观看 | 一a一片一级一片啪啪 | 免费精品 | 天天操天天干天天透 | 国产精品视频免费观看 | 国产在线一区二区 | 免费成人国产 | 亚洲影视在线 | 中文字幕一区二区三区在线观看 | 99热激情 | 天天综合国产 | 久久成人亚洲 |