AsyncLayout Inflation for Recyclerview

yad*_*nan 5 android asynchronous android-inflate layout-inflater android-recyclerview

I am working with two recyclerview in single screen(For android TV).Each recyclerview have complex layout item.And it's taking time to load.I worked with asynclayoutinflator in activities.

    AsyncLayoutInflater inflater = new AsyncLayoutInflater(this);
    inflater.inflate(R.layout.main, null, callback);
Run Code Online (Sandbox Code Playgroud)

I want to know whether there is any ways to achieve the same with recyclerview. Problem I am facing is onbindviewholder is getting called before asyncinflation finished.

小智 1

不知道这是否正是您正在寻找的东西,但我正在考虑在充气机完成工作后将这些物品设置在回收器的适配器中。这样,在 inflate(...) 方法之前,您的适配器 getCount() 将返回 0 并且 onBindViewHolder 将不再被调用。