又到了写博客的时候了,大过年的也算抽空复习了一下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