我在片段中有这个xml代码:
<CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/coordinatorLayout" android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="300dp"
app:layout_scrollFlags="scroll"
android:id="@+id/collapsingToolbarLayout"
app:statusBarScrim="@color/bestColor">
<LinearLayout></LinearLayout> <!--this elements hide then appbar is collapsed-->
</android.support.design.widget.CollapsingToolbarLayout>
<LinearLayout>
<ImageButton>
android:id="@+id/profile_header_trophies"
</ImageButton><!-- this elements like a tab,visible if appbar collapsed-->
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/profile_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
在项目集上的Java类ClickListener:
@OnClick(R.id.profile_header_trophies)
public void profile_header_trophies_clicked() {
if (myProfile != null) {
appBarLayout.setExpanded(false, false);
if (myProfile.getBests().size() == 0) {
profile_recyclerView.smoothScrollToPosition(3);
} else {
profile_recyclerView.smoothScrollToPosition(2 + 20);
}
}
Run Code Online (Sandbox Code Playgroud)
当我点击ImageButton时,我的RecyclerView …
android smooth-scrolling android-recyclerview android-coordinatorlayout
我有Android Studio的问题.将AS更新为2.2后,需要很长时间(约30分钟)来处理,表明它是"构建符号..."项目相当大并且包含NDK组件.
使用gradle构建非常快:
BUILD SUCCESSFUL
time: 12.089 secs
Run Code Online (Sandbox Code Playgroud)
我的gradle_wrapper设置:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
android.useDeprecatedNdk=true
org.gradle.daemon=true
org.gradle.parallel=true
#android.dexOptions.preDexLibraries=true
#android.enableBuildCache=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m-
HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Run Code Online (Sandbox Code Playgroud)
Android Studio有什么问题?我怎样才能加快速度呢?
android ×1