我在约束布局和Appbar布局以及CollapsingToolbarLayout中使用了Coordinator布局,除了属性contentScrim之外,其他所有东西都工作正常。它没有按预期的方式工作。当我向上滚动时,图像仍显示在工具栏中,而不显示我的colorPrimary。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".ProfileActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/myCollapse"
app:title="Fizan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/mToolbar"
app:contentScrim="?android:attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:theme="@style/mToolbar"
app:layout_collapseMode="pin" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="@drawable/profile"
app:layout_collapseMode="parallax" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="jdkhasjkdajksdhjkashdjkhsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsahsak"
android:textSize="35dp" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</android.support.constraint.ConstraintLayout>
答案 0 :(得分:2)
您需要做的就是将ticket,sprint,status,part_of_future_sprint_if_not_closed,no_future_sprint_planned_open_tickets
101,sprint_1,Closed,0,0
102,sprint_1,Open,0,1
103,sprint_2,Working,1,0
103,sprint_3,Fixed,1,0
103,sprint_4,Fixed,1,0
103,sprint_5,Open,1,0
103,sprint_6,Closed,0,0
放在<ImageView>
上方,如下所示:
<Toolbar>
答案 1 :(得分:1)
这个对我有用。从this udemy的材料设计课程中学到了。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.example.karat.collapsetoolbar.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="@+id/appBarLayout"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/collapsingToolBarLayout"
android:fitsSystemWindows="true"
app:contentScrim="@color/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:fitsSystemWindows="true"
android:src="@drawable/ocean_menor"
android:scaleType="centerCrop"
android:contentDescription="@string/ocean"
app:layout_collapseMode="parallax"
/>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:id="@+id/toolBar"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/nestedScrollView"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/linearLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/soonsam"
android:layout_margin="16dp"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/floatingButton"
android:src="@drawable/ic_send"
android:layout_margin="16dp"
app:fabSize="normal"
app:layout_anchor="@+id/appBarLayout"
app:layout_anchorGravity="bottom|end"/>
</android.support.design.widget.CoordinatorLayout>
答案 2 :(得分:1)
这对我有用:
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/myCollapse"
app:title="Fizan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
我希望对您有用:)