Unable to get exact circle shape when using card view
To get a perfect circle shape using a card view, corner radius should be 1/2 of width or height (taking into consideration that it is a square). also, I have noticed that you are using card_view params, don't.
<android.support.v7.widget.CardView
android:layout_width="38dp"
android:layout_height="38dp"
app:cardCornerRadius="19dp"
app:cardElevation="6dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:id="@+id/fab"
android:background="@color/blue"
>
use
shape = "ring"
use same layout_height and layout_weight
and
app:cardCornerRadius= half of layout_height or layout_weight
example
<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="110dp"
android:layout_height="110dp"
android:shape="ring"
app:cardCornerRadius="55dp">
</android.support.v7.widget.CardView>
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
To achieve a circular shape using Card view you can set the shape property, android:shape="ring".
app:cardCornerRadius should be set to half the width or height of the child view
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:innerRadius="0dp"
android:shape="ring"
app:cardCornerRadius="75dp">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:background="@drawable/image" />
</android.support.v7.widget.CardView>