简体   繁体   English

浮动动作按钮模板

[英]Floating action button template

I noticed that this template is used by both messenger, hangout and other apps. 我注意到Messenger,视频群聊和其他应用都使用了此模板。 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 https://github.com/Clans/FloatingActionButton

myxml.xml 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/markormesher/android-fab

https://github.com/Scalified/fab https://github.com/Scalified/fab

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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