有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (2) 个答案

  1. # 2 楼答案

    TabLayout有一个名为tabMode的字段。如果希望它可以滚动,那么设置为TabLayout.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. They are best used for browsing contexts in touch
     * interfaces when users don’t need to directly compare the tab labels.
     *
     * @see #setTabMode(int)
     * @see #getTabMode()
     */
    public static final int MODE_SCROLLABLE = 0;
    

    我还建议你不要让模式滚动,除非你有至少6个标签