Android 如何在操作栏上显示一半在外的图像

Android 如何在操作栏上显示一半在外的图像,android,android-layout,Android,Android Layout,我正在尝试添加一个按钮,如下图所示,它位于操作栏外的一半。我正在寻找一个标准的方式来设计它,因为它是如此普遍的今天 谢谢 您应该查找“浮动操作按钮” 例如: <android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="

我正在尝试添加一个按钮,如下图所示,它位于操作栏外的一半。我正在寻找一个标准的方式来设计它,因为它是如此普遍的今天

谢谢

您应该查找“浮动操作按钮”

例如:

<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/viewA"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.15">

            </LinearLayout>

        <LinearLayout
            android:id="@+id/viewB"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.85" >

        </LinearLayout>

    </LinearLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btn_add"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/activity_horizontal_margin"
        android:clickable="true"
        android:src="@drawable/ic_ok"
        app:layout_anchor="@id/viewA"
        app:layout_anchorGravity="left|bottom"
        app:backgroundTint="@color/accent"/>

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

该按钮称为浮动操作按钮或“FAB”。你想要的是一个协调布局的晶圆厂。 如需进一步阅读,请点击此处:


很抱歉,如果事情如此明显,我仍处于学习阶段。你想要一份工作吗