【问题标题】:Android - Strange fab elevation on Huawei deviceAndroid - 华为设备上奇怪的晶圆厂海拔
【发布时间】:2017-08-11 09:07:29
【问题描述】:

我在华为 7" 设备上得到了奇怪的高度,这是代码:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab_start"
    android:layout_width="92dp"
    android:layout_height="92dp"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="42dp"
    android:src="@mipmap/ic_play_arrow_white_48dp"
    app:backgroundTint="@color/teal"
    app:useCompatPadding="true" />

结果如下:

知道为什么会这样吗?

【问题讨论】:

    标签: android floating-action-button


    【解决方案1】:

    wrap_content 赋予fab 按钮的高度和宽度;

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"    
    

    【讨论】:

    • 成功了!!但是如何增加晶圆厂的规模呢?
    • 你可以试试 app:fabSize="mini"
    • 我需要 fab 尺寸为 92dp,如果我使用 wrap_content 它会太小。
    • 尝试给fab diamension 92dp
    • 我之前试过了,还是不行,我在多台设备上试了这段代码,看起来都不错,除了这个华为。
    猜你喜欢
    • 2015-01-15
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多