2015-11-03 61 views
0

我已經把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

請建議的解決方案。

回答

0

我有同樣的問題預先棒棒糖設備, 我用這些代碼行:

<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 backgroundtint另一個問題,我編程處理:

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

FAB buttons on pre lollipop devices using android support design library