简体   繁体   English

浮动动作按钮背景图形不显示(android)

[英]Floating Action Button background graphic not showing (android)

I am attempting to put a FAB on a fragment. 我试图在一个片段上放一个FAB。 The problem is that the background graphic (it is a plus sign) is not showing up in the circle, it just looks like a solid circle of color at the bottom. 问题是背景图形(它是一个加号)没有显示在圆圈中,它看起来像底部的实心圆形颜色。 Here is my layout: 这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout      xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:gravity="center_horizontal"
tools:context=".SMS2EmailActivity"
android:background="@drawable/backgroundgradient">

<include layout="@layout/contact_content" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    app:srcCompat="@drawable/plus_circle"
    android:tint="@color/tint"        
    app:elevation="4dp"/>

</android.support.design.widget.CoordinatorLayout>

and the included file: 和包含的文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/backgroundgradient"
android:gravity="center_horizontal">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/tvInstructions"
    android:layout_marginRight="10dp"
    android:layout_marginTop="10dp"/>
<Button
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/add"
    android:id="@+id/btnAdd"
    android:layout_below="@id/tvInstructions"
    />
<LinearLayout
    android:id="@+id/layoutEmailContactEXLVHeader"
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:orientation="vertical"
    android:layout_marginRight="0px"
    android:layout_below="@id/btnAdd">
</LinearLayout>

<ExpandableListView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/elvEmailContact"
    android:background="#ffffff"
    android:cacheColorHint="#00000000"
    android:fadeScrollbars="true"
    android:scrollbarAlwaysDrawVerticalTrack="false"
    android:scrollbarStyle="insideInset"
    android:layout_below="@+id/layoutEmailContactEXLVHeader"
    android:scrollbarTrackVertical="@drawable/track"
    android:divider="@color/black"
    android:dividerHeight="1dp"
    >

</ExpandableListView>

What am I doing wrong? 我究竟做错了什么?

I needed to add: 我需要补充一下:

android:src="@drawable/plus_circle

to the FAB layout. 到FAB布局。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM