如何集成线性布局和浮动动作按钮

时间:2015-11-30 09:29:49

标签: android android-layout floating-action-button

我在片段中显示圆形图并使用浮动操作按钮,但浮动操作按钮正在切割图形。

由于浮动操作按钮

,它显示一半图形
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res/com.example.xpressownernew" xmlns:app1="http://schemas.android.com/apk/res-auto">

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="right"
            android:orientation="vertical" >

            <android.support.design.widget.FloatingActionButton
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/floatingButton_dailySale"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="-30sp"
                app1:layout_anchorGravity="right"
                android:src="@drawable/next"
                app:backgroundTint="@color/primary_dark"
                app:elevation="5dp"
                app:fabSize="normal"
                app:rippleColor="@color/primary" />

            //this linear layout is used for display circle graph
            <LinearLayout
                android:id="@+id/graphContainer_dailySale"
                android:layout_width="match_parent"
                android:layout_height="434dp"
                android:clickable="true"
                android:gravity="right"
                android:orientation="vertical" >
            </LinearLayout>
        </LinearLayout>

    </FrameLayout>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

<android.support.design.widget.FloatingActionButton xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="10dp"
        android:clickable="true"
        android:onClick="invokeNewArticle"
        android:src="@drawable/ic_action_new"
        app:backgroundTint="@color/app_color_dark" />