这期内容当中小编将会给大家带来有关Android中使用FloatingActionButton实现一个点击按钮返回顶部功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。FloatingActionButt
这期内容当中小编将会给大家带来有关Android中使用FloatingActionButton实现一个点击按钮返回顶部功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
FloatingActionButton是Design Support库中提供的一个控件,这个控件可以轻松实现悬浮按钮的效果
首先,要在项目中使用这个悬浮按钮就要先把design这个包导入项目
gradle中加入依赖
compile 'com.android.support:design:25.0.0'
接下来就是在xml中使用:
我这里是放置一个listView模拟返回顶部
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="Http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> <ListView android:id="@+id/listview_main" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.FloatingActionButton android:id="@+id/floating_btn_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:src="@mipmap/top" app:elevation="10dp" android:layout_margin="15dp"/></RelativeLayout>
--结束END--
本文标题: Android中使用FloatingActionButton实现一个点击按钮返回顶部功能
本文链接: https://www.lsjlt.com/news/225409.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
2024-05-08
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0