在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Clans/FloatingActionButton开源软件地址(OpenSource Url):https://github.com/Clans/FloatingActionButton开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):WARNING! FURTHER DEVELOPMENT AND SUPPORT IS DISCONTINUED.FloatingActionButtonYet another implementation of Floating Action Button for Android with lots of features. RequirementsThe library requires Android API Level 14+. DemoWatch a short Demo Video on YouTube or try it using Android simulator in the browser on Appetize.io. ScreenshotsFeatures
UsageAdd a dependency to your
Add the <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:src="@drawable/ic_menu"
fab:fab_colorNormal="@color/app_primary"
fab:fab_colorPressed="@color/app_primary_pressed"
fab:fab_colorRipple="@color/app_ripple"/>
</FrameLayout> You can set an icon for the FloatingActionButton using Floating action buttonHere are all the FloatingActionButton's xml attributes with their default values which means that you don't have to set all of them: <com.github.clans.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:src="@drawable/your_icon_drawable"
app:fab_colorNormal="#DA4336"
app:fab_colorPressed="#E75043"
app:fab_colorRipple="#99FFFFFF"
app:fab_showShadow="true"
app:fab_shadowColor="#66000000"
app:fab_shadowRadius="4dp"
app:fab_shadowXOffset="1dp"
app:fab_shadowYOffset="3dp"
app:fab_size="normal"
app:fab_showAnimation="@anim/fab_scale_up"
app:fab_hideAnimation="@anim/fab_scale_down"
app:fab_label=""
app:fab_progress_color="#FF009688"
app:fab_progress_backgroundColor="#4D000000"
app:fab_progress_indeterminate="false"
app:fab_progress_max="100"
app:fab_progress="0"
app:fab_progress_showBackground="true"/> All of these FloatingActionButton's attributes has their corresponding getters and setters. So you can set them programmatically. Floating action menuHere are all the FloatingActionMenu's xml attributes with their default values which means that you don't have to set all of them: <com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
fab:menu_fab_size="normal"
fab:menu_showShadow="true"
fab:menu_shadowColor="#66000000"
fab:menu_shadowRadius="4dp"
fab:menu_shadowXOffset="1dp"
fab:menu_shadowYOffset="3dp"
fab:menu_colorNormal="#DA4336"
fab:menu_colorPressed="#E75043"
fab:menu_colorRipple="#99FFFFFF"
fab:menu_animationDelayPerItem="50"
fab:menu_icon="@drawable/fab_add"
fab:menu_buttonSpacing="0dp"
fab:menu_labels_margin="0dp"
fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
fab:menu_labels_paddingTop="4dp"
fab:menu_labels_paddingRight="8dp"
fab:menu_labels_paddingBottom="4dp"
fab:menu_labels_paddingLeft="8dp"
fab:menu_labels_padding="8dp"
fab:menu_labels_textColor="#FFFFFF"
fab:menu_labels_textSize="14sp"
fab:menu_labels_cornerRadius="3dp"
fab:menu_labels_colorNormal="#333333"
fab:menu_labels_colorPressed="#444444"
fab:menu_labels_colorRipple="#66FFFFFF"
fab:menu_labels_showShadow="true"
fab:menu_labels_singleLine="false"
fab:menu_labels_ellipsize="none"
fab:menu_labels_maxLines="-1"
fab:menu_labels_style="@style/YourCustomLabelsStyle"
fab:menu_labels_position="left"
fab:menu_openDirection="up"
fab:menu_backgroundColor="@android:color/transparent"
fab:menu_fab_label="your_label_here"
fab:menu_fab_show_animation="@anim/my_show_animation"
fab:menu_fab_hide_animation="@anim/my_hide_animation">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/menu_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_star"
fab:fab_size="mini"
fab:fab_label="Menu item 1" />
</com.github.clans.fab.FloatingActionMenu> If you're using custom style for labels - other labels attributes will be ignored. Labels shadow preferences depends on their corresponding FloatingActionButtons' shadow preferences. For more usage examples check the sample project. ChangelogPlease see the Changelog page to see what's recently changed. CreditsI used android-floating-action-button library by Jerzy Chalupski as a base for development. License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论