将个人资料图片添加到底部AppBarLayout(Android)

时间:2018-12-01 12:25:37

标签: android android-coordinatorlayout android-appbarlayout

对不起,我的英语。我尝试了解如何将配置文件图片(ImageView)添加到AppBarLayout中,如下所示:

enter image description here

我已经在模拟器中显示了这样的布局:

enter image description here

在我的代码下面:

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.test.ScrollingActivity3">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.NoActionBar.AppBarOverlay">

        <RelativeLayout
            android:layout_marginTop="20dp"
            android:id="@+id/asd"
            app:layout_scrollFlags="scroll|enterAlways"
            android:background="@color/colorBlack50"
            android:layout_width="match_parent"
            android:layout_height="100dp">

            <TextView
                android:text="asdasd"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </RelativeLayout>



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

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

    <ImageView
        android:id="@+id/fab"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_margin="@dimen/fab_margin"
        app:layout_anchor="@id/asd"
        app:layout_collapseMode="parallax"
        app:background="@drawable/rounded_corner"
        android:src="@drawable/red_bg"
        app:layout_anchorGravity="bottom|end" />

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

我尝试了解此AppBarLayout并执行我想要的操作))

0 个答案:

没有答案