我试图在片段上放置FAB。问题是背景图形(它是一个加号)没有显示在圆圈中,它看起来像底部的实心圆形颜色。这是我的布局:
<?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>
和包含的文件:
<?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>
我做错了什么?
答案 0 :(得分:0)
我需要添加:
android:src="@drawable/plus_circle
到FAB布局。