【问题标题】:Floating Action Button render issue on pre-lollipop versions棒棒糖前版本上的浮动操作按钮呈现问题
【发布时间】:2016-02-03 13:37:46
【问题描述】:

我已将 FAB 放入我的应用程序中,它运行良好。但在棒棒糖之前的版本上看起来很奇怪。它在 FAB 之上有一些丑陋的阴影。这是我的 FAB 标签

<android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:layout_marginRight="16dp"
        android:src="@drawable/ic_arrow_up"
        app:fabSize="normal"
        app:layout_anchor="@id/coordinatorLayout"
        app:layout_anchorGravity="bottom|right|end"
        app:rippleColor="#FFFFFF"
        app:backgroundTint="@color/transperant_black"
        app:elevation="5dp"/>

FAB looks like this on Android 4.2.2 & Android 4.4.4

请提出解决方案。

【问题讨论】:

    标签: android


    【解决方案1】:

    我在棒棒糖之前的设备上遇到了同样的问题, 我使用了这些代码行:

    <android.support.design.widget.FloatingActionButton     xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/FABinstance"
        app:borderWidth="0dp"
        app:elevation="6dp"
        app:rippleColor="@color/transparent_black_hex_5"
        android:src="@drawable/editicon"
        android:backgroundTint="#086428"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="10dp"
        android:layout_marginBottom="10dp" />
    

    我在以编程方式处理的 FAB 背景色方面遇到了另一个问题:

    if (Build.VERSION.SdkInt < Build.VERSION_CODES.Lollipop)
                    {
                        FABinstance.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Color.ParseColor("#086428"));
                    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-30
      • 2015-12-13
      • 1970-01-01
      • 2015-02-26
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      • 2015-01-22
      相关资源
      最近更新 更多