0

在此处输入图像描述

我有关于recyclerview的问题,蓝色是recyclerview,黄色现在是焦点imageview,当我使用keydown时,我想向下滚动,所以想显示绿色imageview但它没有走

我该如何解决?

主要活动是

    recyclerAdapter = new RecyclerAdapter(this, this);
    recyclerView = findViewById(R.id.recyclerView);

    final FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
    layoutManager.setFlexWrap(FlexWrap.WRAP);
    layoutManager.setAlignItems(AlignItems.CENTER);

    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(recyclerAdapter);

布局是

<android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>

和观众

    public class ViewHolder extends RecyclerView.ViewHolder implements View.OnFocusChangeListener {
    FrameLayout frameLayout;
    ImageView image;

    public ViewHolder(View itemView) {
        super(itemView);
        frameLayout = itemView.findViewById(R.id.frameLayout);
        image = (ImageView) itemView.findViewById(R.id.imageView);
        FlexboxLayoutManager.LayoutParams layoutParams = (FlexboxLayoutManager.LayoutParams) itemView.getLayoutParams();
        layoutParams.setFlexGrow(1.0f);

    }
4

1 回答 1

0

将 clicklistener 添加到 imageView 并使用

layoutManager.scrollToPositionWithOffset(position);

于 2018-04-19T03:46:01.693 回答