相关疑难解决方法(0)

android设计TabLayout标签的文字大小

我无法更改设计库tablayout(android.support.design.widget.TabLayout)选项卡的文本大小.

我设法通过在TabLayout中指定tabTextAppearance来更改它

app:tabTextAppearance="@style/MyTabLayoutTextAppearance"
Run Code Online (Sandbox Code Playgroud)

以下风格

<style name="MyTabLayoutTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse">
    <item name="android:textSize">14sp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

但我有2个副作用:

1)我丢失了所选标签的强调色

2)标签文本不再大写.

android text-size android-tablayout

84
推荐指数
7
解决办法
10万
查看次数

滑动选项卡布局文本是大写的

嗨,我在我的应用程序中使用滑动选项卡布局,这一切都很好.我唯一不理解的是为什么我的标签文本是大写的.

我打印了选项卡在滑动选项卡类中的文本,它们不是大写的.我环顾四周,没有调用toUpperCase方法.

以下是设置文本的类中的代码:

  private void populateTabStrip() {
        final PagerAdapter adapter = mViewPager.getAdapter();
        final View.OnClickListener tabClickListener = new TabClickListener();

        for (int i = 0; i < adapter.getCount(); i++) {
            View tabView = null;
            TextView tabTitleView = null;

            if (mTabViewLayoutId != 0) {
                // If there is a custom tab view layout id set, try and inflate it
                tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
                        false);
                tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
            }

            if (tabView == null) {
                tabView = createDefaultTabView(getContext());
            }

            if (tabTitleView == null && …
Run Code Online (Sandbox Code Playgroud)

android android-tabs

7
推荐指数
2
解决办法
7930
查看次数