【发布时间】:2018-02-16 07:43:15
【问题描述】:
如何在我的header_cover_image 中添加CollapsingToolbarLyout 参见下图蓝色突出显示的那个。
我尝试了很多工作,但仍然无法弄清楚。我希望你能帮助我谢谢你!
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout">
<ImageView
android:id="@+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:scaleType="centerCrop"
android:src="@drawable/user_cover" />
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:clickable="true"
app:civ_border_width="3dp"
app:civ_border_color="#FFFFFFFF"
android:id="@+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="@+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-130dp"
android:elevation="5dp"
android:padding="20dp"
android:scaleType="centerCrop"
android:src="@drawable/hooman" />
<RelativeLayout
android:id="@+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header_cover_image"
android:background="@color/purpleCorallite"
android:elevation="4dp"
android:paddingBottom="24dp">
<ImageView
android:id="@+id/btnEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"
android:src="@android:drawable/ic_menu_edit" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="Name"
android:textColor="#fff"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="@+id/user_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Email@email.com"
android:textColor="#fff"
android:textSize="18sp" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
【问题讨论】:
-
搜索教程而不是 Here is one 。如果您在实施后发现任何问题,欢迎您在这里提问。
标签: android android-layout android-styles android-collapsingtoolbarlayout