Java 将适配器设置为RecyclerView或notifyDataSetChanged时使用frezzing ui应用程序

Java 将适配器设置为RecyclerView或notifyDataSetChanged时使用frezzing ui应用程序,java,android,adapter,Java,Android,Adapter,我有30个项目的清单。当我将适配器设置为RecyclerView时 或者当调用notifyDataSetChanged方法时,应用程序的ui将 发几秒钟的泡沫 这是我的密码 adapater和set: public AdapterBarberWorkTimeDetails(List<BarberWorkPeriodItems> items, int itemLayout, Context context, String date, FragmentReserveBarbe

我有30个项目的清单。当我将适配器设置为RecyclerView时
或者当调用notifyDataSetChanged方法时,应用程序的ui将 发几秒钟的泡沫

这是我的密码 adapater和set:

      public AdapterBarberWorkTimeDetails(List<BarberWorkPeriodItems> items, int itemLayout, Context context, String date, FragmentReserveBarberWorkTime parentFragment) {
        this.items = items;
        this.itemLayout = itemLayout;
        this.mContext = context;
        this.date = date;
        this.parentFragment = parentFragment;
        }

 public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
public AdapterBarberWorkTimeDetails(列表项、int-itemLayout、上下文上下文、字符串日期、FragmentReserveBarberWorkTime父片段){
这个项目=项目;
this.itemLayout=itemLayout;
this.mContext=上下文;
this.date=日期;
this.parentFragment=parentFragment;
}
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent,int viewType){
视图v=LayoutInflater.from(parent.getContext()).flate(itemLayout,parent,false); 返回新的视图持有者(v); }

  public void onBindViewHolder(@NonNull final AdapterBarberWorkTimeDetails.ViewHolder holder, final int position) {

  holder.itemView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                             // do some thing
                              }
               // set text to items
  }

//the viewholder
    public static class ViewHolder extends RecyclerView.ViewHolder {

        public ViewHolder(View itemView) {
            super(itemView);
          // finde items
        }
    }

}

---- 
// the mothod  call adaptet and set it to RecyclerView

 public void generateSpecialDaysDetails(List<BarberWorkPeriodItems> workPeriods, String date) {
        adapterBarberWorkTimeDetails = new AdapterBarberWorkTimeDetails(workPeriods, R.layout.adapter_barber_work_periods, getActivity(), date, this);
        rvWorkPeriod.setHasFixedSize(true);
        rvWorkPeriod.setAdapter(adapterBarberWorkTimeDetails);
        linearLayoutManager = new GridLayoutManager(getActivity(), 4, StaggeredGridLayoutManager.VERTICAL, false);
        rvWorkPeriod.setLayoutManager(linearLayoutManager);

    }
public void onBindViewHolder(@NonNull final AdapterBarberWorkTimeDetails.ViewHolder holder,final int position){
holder.itemView.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图){
//做点什么
}
//将文本设置为项目
}
//持票人
公共静态类ViewHolder扩展了RecyclerView.ViewHolder{
公共视图持有者(视图项视图){
超级(项目视图);
//芬德项目
}
}
}
---- 
//方法调用adaptet并将其设置为RecyclerView
public void generateSpecialDaysDetails(列出工作期间、字符串日期){
adapterBarberWorkTimeDetails=新adapterBarberWorkTimeDetails(工作期间,R.layout.adapter\u barber\u工作期间,getActivity(),日期,this);
rvWorkPeriod.setHasFixedSize(true);
rvWorkPeriod.setAdapter(适配器RBerWorkTimeDetails);
linearLayoutManager=新的GridLayoutManager(getActivity(),4,StaggedGridLayoutManager.VERTICAL,false);
rvWorkPeriod.setLayoutManager(linearLayoutManager);
}
//我的xml

//item view for adapter;
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">



           <TextView
                android:id="@+id/txtHours"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:layout_marginLeft="4dp"
                android:layout_marginBottom="4dp"
                android:gravity="center"
                android:text="00:00"
                android:textSize="15dp"
                android:textStyle="bold" />
        </LinearLayout>
// the RecyclerView
      <android.support.v7.widget.RecyclerView
                                android:id="@+id/rvWorkPeriod"
                                android:layout_width="0dp"
                                android:layout_height="300dp"
                                android:layout_margin="8dp"
                                android:minHeight="100dp"
                                app:layout_constraintEnd_toEndOf="parent"
                                app:layout_constraintStart_toStartOf="parent"
                                app:layout_constraintTop_toTopOf="parent" />
//适配器的项目视图;
//回收视图

问题出在哪里?

在调用此适配器的地方发布代码。同时发布整个适配器代码以更好地理解它。
ApplicationLoader.detectTimeStatus
做什么?@haresh编辑了我的问题you@Md.Asaduzzaman获取某些状态的颜色这很可能是与视图相关的问题。发布回收者视图及其项目XML代码。