Android学习——FloatingActionButton制作简易弹出菜单

这篇博客介绍了如何在Android开发中利用FloatingActionButton创建一个简单的弹出菜单。首先,通过Project Structure添加design依赖。接着,修改XML布局文件。最后,更新MainActivity.java的代码来实现功能。
摘要由CSDN通过智能技术生成

        又到了写博客的时候了,大过年的也算抽空复习了一下Android开发,今天来做个简单一点的弹出菜单,这里用到了FloatingActionButton,废话不多说直接上代码

        第一步:File--Project Structure--app--Dependencies里添加design依赖。

        第二步:修改XML为如下

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.drw.myapplication.MainActivity">
<!--这里添加了五个FloatingActionButton,id分别为start,first,second,third,forth,五个Button重叠,后面会写优化篇,现在这一次就直接这样了-->
<android.support.design.widget.FloatingActionButton
    android:id="@+id/start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值