我在CollapsingToolbarLayout中有recyclelerview,我希望它可以滚动,但事实并非如此。当我滚动时,appbar滚动但不是recyclelerview。我尝试了不同的东西,但它不起作用。这是我的代码:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/caves_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapse"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll"
android:nestedScrollingEnabled="true"
app:titleEnabled="false">
<ImageView
android:id="@+id/caves_backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@mipmap/mount"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="200dp"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:theme="@style/WhiteToolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="none" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/content"/>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
答案 0 :(得分:5)
我找到了解决方案:
GL11.glPushMatrix();
float rotateAxis = 1.0f;
float stableAxis = 0.0f;
int degreesPitch = (1+random.nextInt(4))*90;
int degreesRoll = (1+random.nextInt(4))*90;
int degreesYaw = (1+random.nextInt(4))*90;
GL11.glRotate(degreesRoll , stableAxis ,stableAxis ,rotateAxis );
GL11.glRotate(degreesYaw , stableAxis ,rotateAxis ,stableAxis );
GL11.glRotate(degreesPitch ,rotateAxis ,stableAxis ,stableAxis );
//Your tessellator code
tessellator.draw();
GL11.glPopMatrix();
答案 1 :(得分:0)
在Appbarlayout中将“水平轨道”设置为false
此问题已解决。让我知道它是否不起作用
代码
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#fff"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar2"
android:scrollbarAlwaysDrawHorizontalTrack="false"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:expandedTitleTextAppearance="@style/TransparentText">