如何改变Android的设计支持库FAB按钮边框颜色?
问题描述:
我想改变晶圆厂按钮边框的颜色。
边框颜色是白色的,里面的颜色是黑色或透明
I want to change fab button border color. border color is white, inside color is black or transparent
我想我的按钮看起来是这样的:
I'd like my button to look like this:
答
fab.xml 在绘制
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false" >
<solid android:color="@android:color/transparent" />
<stroke
android:width="3dp"
android:color="@android:color/white" />
</shape>
在
浮动操作按钮布局
<android.support.design.widget.FloatingActionButton
android:id="@+id/buttton_float"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_social_notifications"
android:background="@drawable/fab"
android:layout_margin="@dimen/fab_margin"
android:layout_gravity="bottom|right"
app:fabSize="normal"
app:backgroundTint="@android:color/white"
app:rippleColor="@android:color/black"
app:borderWidth="0dp"
app:elevation="2dp"
app:pressedTranslationZ="12dp"/>
注意:自定义的设计为您的FAB是对谷歌的材料设计为浮动操作按钮
Note : The custom design for your FAB is against the guidelines of Google Material Design for Floating Action Button