Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

字体尺寸的问题 #37

Open
AndyLeeBlue opened this issue Feb 10, 2019 · 1 comment
Open

字体尺寸的问题 #37

AndyLeeBlue opened this issue Feb 10, 2019 · 1 comment

Comments

@AndyLeeBlue
Copy link

AndyLeeBlue commented Feb 10, 2019

toolbat参数使用的都是dp,这导致不会随着系统字体设置变化,但是下面的tabbar却又是sp的,当系统字体变大后会和图标重叠。建议增加一个属性,可供设置字体是dp还是sp,并开放tabbar的设置字体尺寸的属性。另外,图标和文字之间的间隔空间属性,能不能也开放,谢谢

@listenzz
Copy link
Owner

listenzz commented Feb 11, 2019

你好,TabBar 底层使用的是 BottomNavigation ,可设置参数查看这里

在 style.xml 或 dimens.xml 文件中添加如下设置并调整其中参数即可。

 <dimen name="fixed_height_top_padding_inactive">2dp
    </dimen><!-- 8(Top Padding) - 12/2(extra padding due to badges) = 2 -->
    <dimen name="fixed_height_top_padding_active">0dp
    </dimen><!-- 6(Top Padding) - 12/2(extra padding due to badges) = 0 -->
    <dimen name="fixed_height_bottom_padding">10dp</dimen>

    <dimen name="fixed_label_active">14sp</dimen>
    <dimen name="fixed_label_inactive">12sp</dimen>
    <item name="fixed_label_active_to_inactive_ratio" format="float" type="dimen">0.857</item>

    <dimen name="fixed_icon_grid">24dp</dimen>
    <dimen name="fixed_icon_badge_grid_height">36dp
    </dimen><!-- this adds 6 dp extra to top and bottom icon -->
    <dimen name="fixed_icon_badge_grid_width">48dp
    </dimen><!-- this adds 6 dp extra to top and bottom icon -->

譬如 demo 中就作了如下调整:

    <dimen name="fixed_height_bottom_padding">4dp</dimen>
    <dimen name="fixed_height_top_padding_active">2dp</dimen>
    <dimen name="fixed_height_top_padding_inactive">2dp</dimen>
    <dimen name="fixed_icon_grid">24dp</dimen>
    <dimen name="fixed_label_active">12dp</dimen>
    <dimen name="fixed_label_inactive">12dp</dimen>
    <item name="fixed_label_active_to_inactive_ratio" format="float" type="dimen">1</item>
    <dimen name="badge_corner_radius">14dp</dimen>
    <dimen name="badge_height_padding">1dp</dimen>
    <dimen name="badge_width_padding">5dp</dimen>
    <dimen name="badge_text_size">12dp</dimen>
    <dimen name="badge_top_margin">1dp</dimen>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants