小编eld*_*o87的帖子

RecyclerView - 滚动期间如何突出显示中央可见项目

我需要一个像这样的RecyclerView:

在此输入图像描述

它应该做:

  • 每次显示7件物品(DONE)

  • 将RecyclerView置于中央可见项目(DONE)的中心

  • 当我向右/向左滚动时,中央项目将"突出显示"(按钮被选中>蓝色)(需要帮助)

  • 当我点击一个按钮时,它将以平滑的scrool为中心(需要帮助)

我使用SnapHelperclass将RecyclerView置于中心项目的中心(我检索中心可见项目,让最近的孩子到屏幕中心)

我的适配器:

public class RvTrendsGraphAdapter extends RecyclerView.Adapter<RvTrendsGraphAdapter.ViewHolder> {

    private float deviceWidth;
    private float itemWidth;

    private List<RvTrendsGraphModel> models;
    private Context context;

    public RvTrendsGraphAdapter(Context context, List<RvTrendsGraphModel> models) {
        this.models = models;
        this.context = context;
    }

    private Context getContext() {
        return context;
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.rv_trends_graph_layout) PercentRelativeLayout rootLayout;
        @BindView(R.id.rv_trends_graph_layout_superiore) PercentRelativeLayout layoutSuperiore;
        @BindView(R.id.rv_trends_graph_layout_inferiore) RelativeLayout layoutInferiore;
        @BindView(R.id.rv_trends_graph_vertical_progressbar) ProgressBar verticalProgressBar;
        @BindView(R.id.rv_trends_graph_button) Button timeLapseButton;

        public ViewHolder(View itemView) …
Run Code Online (Sandbox Code Playgroud)

android android-adapter android-recyclerview

10
推荐指数
1
解决办法
3743
查看次数

在 Android 中创建圆形/环形图

我想在 Android 上创建一个圆形/环形图。

我想要达到的结果如下:

在此处输入图片说明

是否有库或任何默认方式来创建它?

java android pie-chart mpandroidchart

2
推荐指数
1
解决办法
1645
查看次数