Reputation: 1204
The button at the bottom, Map/filter. It's from the expedia app. What kind of button is it? Can a FAB be overriden to have two button?
Upvotes: 0
Views: 84
Reputation: 54194
My best guess, as someone who has made an extremely similar widget myself, is that this is neither a FAB nor even a Button at all. It's probably just a floating ViewGroup with two clickable areas (maybe a LinearLayout holding two TextViews, for instance).
You create it by using a FrameLayout
(or spiritual subclass like CoordinatorLayout
) to host your main content view, and then your "button" view group on top of that. CardView
is a great way to get rounded corners and elevation on all Android API levels:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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">
<!-- insert your content here -->
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginBottom="32dp"
android:layout_gravity="center_horizontal|bottom"
app:cardCornerRadius="24dp"
app:cardElevation="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="48dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="12dp"
android:gravity="center"
android:drawableStart="@drawable/icon_map"
android:drawablePadding="6dp"
android:textColor="#00f"
android:textSize="18sp"
android:text="@string/label_map"
android:fontFamily="sans-serif-medium"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:background="#ccc"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="12dp"
android:gravity="center"
android:drawableStart="@drawable/icon_filters"
android:drawablePadding="6dp"
android:textColor="#00f"
android:textSize="18sp"
android:text="@string/label_filters"
android:fontFamily="sans-serif-medium"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
Upvotes: 2