美文网首页
recyclerView 记录一个问题

recyclerView 记录一个问题

作者: 菜鸟何时起飞 | 来源:发表于2020-12-23 19:20 被阅读0次

    1 setAdapter
    据说会标记所有的数据都为无效数据重新绑定新的数据

    2 swapAdapter

     /**
         * Swaps the current adapter with the provided one. It is similar to
         * {@link #setAdapter(Adapter)} but assumes existing adapter and the new adapter uses the same
         * {@link ViewHolder} and does not clear the RecycledViewPool.
         * <p>
         * Note that it still calls onAdapterChanged callbacks.
         *
         * @param adapter The new adapter to set, or null to set no adapter.
         * @param removeAndRecycleExistingViews If set to true, RecyclerView will recycle all existing
         *                                      Views. If adapters have stable ids and/or you want to
         *                                      animate the disappearing views, you may prefer to set
         *                                      this to false.
         * @see #setAdapter(Adapter)
         */
    

    要求是布局要一样活着类似 如果布局不一样复用的时候会出现转换异常的问题

    相关文章

      网友评论

          本文标题:recyclerView 记录一个问题

          本文链接:https://www.haomeiwen.com/subject/ozeunktx.html