简体   繁体   中英

Floating action button template

I noticed that this template is used by both messenger, hangout and other apps. How can I achieve the same result?

在此处输入图片说明

在此处输入图片说明

I have used a library for getting these layouts. This is part of the code that I have used. For more information about the library please go to this link. https://github.com/Clans/FloatingActionButton

myxml.xml

<com.github.clans.fab.FloatingActionMenu
        android:id="@+id/menu_red"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:paddingRight="10dp"
        android:paddingBottom="10dp"
        android:paddingLeft="10dp"
        htext:menu_labels_ellipsize="end"
        htext:menu_labels_singleLine="true"
        htext:menu_backgroundColor="#ccffffff"
        >

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fabphy"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_star_big_on"
            android:visibility="gone"
            htext:fab_size="mini"
            htext:fab_label="Load Physics" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fabche"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_star_big_on"
            android:visibility="gone"
            htext:fab_size="mini"
            htext:fab_label="Load Chemistry" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fabmat"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_star_big_on"
            android:visibility="gone"
            htext:fab_size="mini"
            htext:fab_label="Load Maths" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fabgk"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/btn_star_big_on"
            android:visibility="gone"
            htext:fab_size="mini"
            htext:fab_label="Load GK" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fabsd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/stat_notify_sdcard"
            htext:fab_size="mini"
            htext:fab_label="Load SD Card" />

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_menu_search"
            htext:fab_size="mini"
            htext:fab_label="Change folder" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_input_add"
            htext:fab_size="mini"
            android:visibility="gone"
            htext:fab_label="Add file" />
    </com.github.clans.fab.FloatingActionMenu>

You need to make it custom for that

<uk.co.markormesher.android_fab.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

https://github.com/markormesher/android-fab

https://github.com/Scalified/fab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM