package com.example.myapplication.mvvm;
import android.content.Context;
import android.util.AttributeSet;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SnapHelper;
public class DYLinearLayout extends LinearLayoutManager {
PagerSnapHelper helper;
public DYLinearLayout(Context context) {
super(context);
}
public DYLinearLayout(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
public DYLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void onAttachedToWindow(RecyclerView view) {
super.onAttachedToWindow(view);
if (helper == null) {
helper = new PagerSnapHelper();
}
helper.attachToRecyclerView(view);
SnapHelper snapHelper = new PagerSnapHelper();
// snapHelper.attachToRecyclerView(helper.recyNavigation);
// helper.recyNavigation.setOnFlingListener(null);
}
}
滑动布局(改进)
最新推荐文章于 2025-08-02 12:48:31 发布
879

被折叠的 条评论
为什么被折叠?



