If you want to set Float button border then you just do this things. First Create one xml file
fab_background.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false" >
<!--Here if you want to set transparent can set-->
<solid android:color="@color/white" />
<!--Here you can set your fab button border color-->
<stroke
android:width="3dp"
android:color="@color/white" />
</shape>
You will have to play with the thickness and innerRadius attributes to get it right, but that should do it! Also the bitmap source is just a filler, you want to put your F image there.
Then where you declare your fab, reference your ring like such:
android:background="@drawable/ring"
OR
In your java code, do the following:
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setBackgroundResource(R.drawable.ring);
fab.xml in
drawable
Floating Action Button in
layout
Note : The custom design for your FAB is against the guidelines of Google Material Design for Floating Action Button
If you want to set Float button border then you just do this things. First Create one xml file
fab_background.xml
Then after use like this in your xml layout file.
main_activity.xml
You can use the following solution:
It works fine for the border. looks like below
First create a .xml shape resource let's call it ring.xml and put the following in it:
You will have to play with the thickness and innerRadius attributes to get it right, but that should do it! Also the bitmap source is just a filler, you want to put your F image there.
Then where you declare your fab, reference your ring like such:
OR
In your java code, do the following:
Hope this helps!
you can make circle without drawable
output :