zoukankan      html  css  js  c++  java
  • 安卓开发之实现下角圆形按钮

    如图:

    布局的xml文件中:

    <ImageButton
    android:id="@+id/fabButton"
    android:layout_width="56dp"
    android:layout_height="56dp"
    android:layout_gravity="bottom|right"
    android:layout_marginBottom="16dp"
    android:layout_marginRight="16dp"
    android:background="@drawable/fab_background"  //圆形背景
    android:src="@drawable/ic_favorite_outline_white_24dp"   //圆形上的图片,自己设置
    />

    drawable文件夹下的fab_background.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <!--drawable/btn_fab_default.xml-->
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    //设置边框
    <item android:bottom="0dp" android:left="2dp" android:right="2dp" android:top="2dp">
    <shape android:shape="oval">
    <solid android:color="@color/color_shadow" />
    </shape>
    </item>

    //设置边框
    <item android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp">
    <shape android:shape="oval">
    <solid android:color="@color/color_primary_red" />
    </shape>
    </item>
    </layer-list>

    values中的color.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <color name="color_primary_red">#f44336</color>
    <color name="color_primary_red_dark">#d32f2f</color>
    <color name="color_primary_green"> #4caf50</color>
    <color name="color_primary_green_dark">#388e3c</color>
    <color name="color_shadow">#44000000</color>
    </resources>

  • 相关阅读:
    MariaDB:SSL配置
    JDBC连接MariaDB:数据传输加密
    海康JAVA SDK库动态路径加载
    druid:java代码创建连接池
    webservice:com.sun.xml.internal.ws.server.ServerRtException: [failed to localize]
    RabbitMQ:MSVCR120.dll ,c000001d 错误
    mariadb:分区自动创建与删除
    前-后 分离 01
    03 注解开发
    02
  • 原文地址:https://www.cnblogs.com/scbxiang/p/4467714.html
Copyright © 2011-2022 走看看