Hello Friends,
In my last blog I have explained about how to create floating action button using CoordinatorLayout, LinearLayout, TextView and FloatingActionButton. But in this tutorial I have created a new floating action button layout using single LinearLayout.
You can see the below example it will clearly describe you how to create Floating action button layout in android.
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_purple"
android:orientation="horizontal">
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
android:src="@drawable/icon2"
app:layout_anchor="@id/viewA"
app:layout_anchorGravity="bottom|end|right"/>
</android.support.design.widget.CoordinatorLayout>
0 Comment(s)