我在recyclerview中的最后一项未显示。一旦获得焦点,顶部栏应保持可见。它不应向上滚动。
我的代码如下:
<android.support.design.widget.CoordinatorLayout
android:id="@+id/content_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
tools:visibility="visible"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:visibility="invisible"
app:elevation="0dp"
app:layout_behavior="haygot.togyah.app.newDesign.home.FlingBehaviour"
tools:visibility="visible"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:minHeight="?android:attr/actionBarSize"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/leaderboard_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/spacing_large"
android:src="@drawable/ic_leaderboard_icon" />
<haygot.togyah.app.widget.TextView.TextViewPlus
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_toLeftOf="@+id/doubts"
android:layout_toRightOf="@+id/leaderboard_iv"
android:alpha="0"
android:gravity="center"
android:text="What would you like to learn today?"
android:textAppearance="@style/CollapsingToolbarTitle" />
<android.support.v7.widget.AppCompatImageView
android:id="@+id/doubts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/spacing_large"
android:src="@drawable/ic_doubt_home" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/home_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/ic_dash_profile_icon"
android:visibility="visible" />
<haygot.togyah.app.widget.TextView.TextViewPlus
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/home_icon"
android:layout_marginBottom="@dimen/spacing_36dp"
android:layout_marginTop="-20dp"
android:gravity="center"
android:letterSpacing="-.03"
android:lineSpacingExtra="4dp"
android:minLines="3"
android:textColor="@android:color/white"
android:textSize="@dimen/app_text_size_xxxlarge"
android:textStyle="bold"
app:customFont="@string/font_proxima_nova_bold"
tools:text="Hello Anudeep, \n let's learn something\n new today!" />
</RelativeLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:nestedScrollingEnabled="true"
android:id="@+id/subjects_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true"
android:paddingBottom="@dimen/spacing_small"
android:paddingLeft="@dimen/spacing_small"
android:paddingRight="@dimen/spacing_small"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
当我向上移动时,回收站中的最后一个项目是部分可见的。
我该如何解决?
最佳答案
确保为工具栏和折叠工具栏设置最小高度:
<android.support.design.widget.CollapsingToolbarLayout
android:minHeight="?attr/actionBarSize"
<android.support.v7.widget.Toolbar
android:minHeight="?attr/actionBarSize"
关于android - Recyclerview协调器布局中未显示的最后一项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43116655/