广告
返回顶部
首页 > 资讯 > 精选 >Android中使用FloatingActionButton实现一个点击按钮返回顶部功能
  • 637
分享到

Android中使用FloatingActionButton实现一个点击按钮返回顶部功能

androidroifloatingactionbutton 2023-05-31 12:05:08 637人浏览 独家记忆
摘要

这期内容当中小编将会给大家带来有关Android中使用FloatingActionButton实现一个点击按钮返回顶部功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。FloatingActionButt

这期内容当中小编将会给大家带来有关Android中使用FloatingActionButton实现一个点击按钮返回顶部功能,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

FloatingActionButton是Design Support库中提供的一个控件,这个控件可以轻松实现悬浮按钮的效果

首先,要在项目中使用这个悬浮按钮就要先把design这个包导入项目
gradle中加入依赖

compile 'com.android.support:design:25.0.0'

接下来就是在xml中使用:
我这里是放置一个listView模拟返回顶部

<&#63;xml version="1.0" encoding="utf-8"&#63;><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文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作