我有一个在CoordinatorLayout中托管的垂直RecyclerView,具有折叠工具栏布局.此RecyclerView的ViewHolder包含另一个带有GridLayoutManager的RecyclerView.
这种嵌套的原因是内部RecyclerView显示的图片集合可以包含1-20张图片.我不知道会有多少张图片,但Grid的跨度必须始终为3.每次绑定ViewHolder时,我都会调整RecyclerView的布局参数以容纳内容.
如果没有CollapsingToolBarLayout,这很有效.但是,如果有一个折叠的工具栏,用我的手指在内部RecyclerView上滚动不会滚动折叠工具栏,但滚动另一个项目却会.
要重新强调,在绑定的ViewHolder中,如果我开始滚动除嵌套的RecyclerView之外的任何其他项目,滚动工作正常.但是,如果我在嵌套的RecyclerView上开始滚动,那么它会中断.
是否可以阻止内部RecyclerView上的滚动拦截,只允许父滚动?我希望内部的RecyclerView仍能处理点击.
以下是该现象的YouTube链接:https://youtu.be/fzj7HmqskzU
以下是父RecyclerView的XML:
<android.support.design.widget.CoordinatorLayout 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=".MainActivityFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
app:contentScrim="?attr/colorPrimary"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
android:id="@+id/header_view"
android:layout_width="match_parent"
android:layout_height="192dp"
android:animateLayoutChanges="true"
android:background="@color/primary" />
<android.support.v7.widget.Toolbar
android:id="@+id/action_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/abc_action_bar_default_height_material"
android:elevation="4dp"
app:layout_collapseMode="pin"
app:popupTheme="@style/Theme.AppCompat.NoActionBar"
app:theme="@style/Theme.AppCompat.NoActionBar" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
这是托管嵌套RecyclerView的主要ViewHolder:
public class SimpleAdapter extends RecyclerView.Adapter<SimpleAdapter.ViewHolder> {
private static final int MODEL_OBJECT = 1;
private List<ModelObject> modelObjects;
private Context context;
private int imageSize;
public SimpleAdapter(List<ModelObject> modelObjects) …Run Code Online (Sandbox Code Playgroud) android-recyclerview androiddesignsupport android-collapsingtoolbarlayout android-appbarlayout
我有一个使用SpringSecurity 2.0.5在Spring 3下运行的Web应用程序.为了向用户呈现自上次访问以来对站点的更改,我尝试记录其会话被销毁的时间.因此我注册了org.springframework.context.ApplicationListener<HttpSessionDestroyedEvent>也是一个javax.servlet.http.HttpSessionListener.当用户使用注销链接时,实现的方法有效.但是当会话超时时,就好像事件没有生成一样.
我忘了听正确的事吗?或者会话超时没有解雇?有没有其他方法来实现这一目标?它取决于服务器设置(tomcat 6.0.24 btw)吗?
我在Bean Shell采样器中编写以下脚本但是没有正确执行,
JMeter永远不会进入"if"状态,我做错了什么?
*WRIDTEMP是一个变量,WRId是一个具有从csv文件中检索的值的变量.
if((vars.get("WRIDTEMP")==vars.get("WRId")) || vars.get("WRIDTEMP")==0)
{
String i = vars.get("C");
int counter = Integer.parseInt(i);
counter++;
vars.put("C", "" + counter);
if(counter<10 )
{
vars.put("Message",temp+authString);
}
}
Run Code Online (Sandbox Code Playgroud) 我的活动中有以下布局:
CoordinatorLayout
?? AppBarLayout
? ?? CollapsibleToolbarLayout
? ?? TextView (parallax)
? ?? TextView (pin)
? ?? Toolbar
?? NestedScrollView
?? LinearLayout
?? TextView 1
?? LinearLayout 1
? ?? 1 to n Views (dynamically added/removed)
...
?? TextView n
?? LinearLayout n
?? 1 to n Views (dynamically added/removed)
当我将Layouts中的animateLayoutChanges设置为true时,无论何时在NestedScrollView内部发生布局更改,结果布局都会与AppBarLayout的内容重叠.
我尝试了这个stackoverflow评论中的建议,但它没有帮助.
有没有人有类似/相同的问题,并找到了解决方案?
android android-animation android-layout android-collapsingtoolbarlayout android-appbarlayout
android-collapsingtoolbarlayout ×2
android ×1
beanshell ×1
java ×1
jmeter ×1
load-testing ×1
servlets ×1
spring ×1
spring-mvc ×1
testing ×1