zoukankan      html  css  js  c++  java
  • Android Studio 使用悬浮按钮 FloatingActionButton

    Android Studio 使用悬浮按钮 FloatingActionButton

    最近做毕业设计需要做一个悬浮的语音输入按钮,要固定在屏幕下方,使用的是 FloatingActionButton ,代码很简单,下面贴一下:

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/yuyin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_alignParentBottom="true"
        android:clickable="true"
        android:src="@mipmap/yuyin"
        android:layout_marginBottom="40px"
        app:backgroundTint="@android:color/background_light"
        tools:visibility="visible" />
    

    注意这个组件是Android5以上才可以用,而且他要被包含在 RelativeLayout 布局下面才可以。

    因为就这一个按钮,所以说点击事件就像普通按钮的点击事件一样就可以了。

  • 相关阅读:
    selenium 难定位元素、时间插件
    列表生成式
    三元表达式
    监控日志
    非空即真
    深拷贝浅拷贝
    元组
    list字典嵌套
    2021
    布尔类型
  • 原文地址:https://www.cnblogs.com/wjw1014/p/12836367.html
Copyright © 2011-2022 走看看