即使我将定位点设置为bottom|right
,我也无法在我的应用程序的右下方插入晶圆厂图标,请大家帮我这么做,因为晶圆厂图标显示在应用程序的左上角。无法将我的晶圆厂图标设置到我的页面右下方
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.kun.carkila.OwnerTabs">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/plus"
app:layout_anchor="@+id/container"
app:layout_anchorGravity="bottom|right" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@drawable/ic_directions_car_white_48dp"
app:layout_anchor="@+id/container"
app:layout_anchorGravity="bottom|right" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="#990000"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay"
android:background="#990000">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</LinearLayout>
我相信你的父'ViewGroup'必须是'CoordinatorLayout'才能将'Views'锚定到彼此。 – Emmanuel
@Emmanuel - 是的,该linearLayout的下一个父级是协调员布局。 – JosephG
@Emmanuel - 更新代码先生 – JosephG