I'm using card view for floating action button in android material design. I'm using following code for get the circle
<android.support.v7.widget.CardView
android:id="@+id/fab"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
card_view:background="@color/blue"
card_view:cardCornerRadius="19dp"
card_view:cardPreventCornerOverlap = "false"
card_view:cardElevation="6dp" >
</android.support.v7.widget.CardView>
I have set corner radius as half of width. but still I can't get the circle shape.
I have solved the problem. Now android providing design library for material design, which has the FloatingActionButton. No need of customizing card view for floating action button.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin" />
Add design library in gradle dependencies
compile 'com.android.support:design:23.1.1'
For more detail refer this link