java - float 操作按钮加号未显示

标签 java android xml floating-action-button

我在前面的 fragment 中成功创建了一个带有加号的 FAB。但是,我正在尝试再次创建它,但出于某种原因,模拟器没有呈现加号。这是我的 XML:

<android.support.design.widget.FloatingActionButton
            android:layout_centerVertical="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:id="@+id/add_answers_button"
            android:visibility="visible"
            android:clickable="true"
            android:layout_width="30dp"
            android:layout_height="30dp"
            app:backgroundTint="@color/actionRed"
            android:src="@drawable/ic_add_white_24dp"
            app:elevation="0dp" />

预览(API 21):

enter image description here

模拟器:

enter image description here

下面是可绘制对象:

enter image description here

最佳答案

我认为您正在使用 vector 绘图。它们只能从 Lolipop 开始使用。因此,您需要将 .png 可绘制对象包含到您的项目中。

关于java - float 操作按钮加号未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38215565/

相关文章:

java - http协议(protocol)版本 "HTTP/1.1"是否包括https?

java - Selenium Webdriver 警告 - 无效 token "screen"

android - setContentView 使 ListView 中的 Android 应用程序崩溃

c# - VS 2017 启用有关缺少 XML 注释的警告

java - 创建 Android 应用程序时 Eclipse ADT 出错

java - JHipster - 将默认页面更改为某个实体页面

Java:设计除主框架之外的 JFrame

android - 如何在 Android 上链接 .so 库

android - 将 View 从一个坐标动画化到另一个坐标的正确方法是什么?

mysql - 从 MySQL 中的 XML 中检索到的提取数据重复