Android 如何使用FlexboxLayou反转回收视图的填充?

Android 如何使用FlexboxLayou反转回收视图的填充?,android,firebase-realtime-database,android-recyclerview,android-flexboxlayout,Android,Firebase Realtime Database,Android Recyclerview,Android Flexboxlayout,我在我的项目中使用FlexboxLayou,但我无法反转从firebase获取的数据,我希望它按降序排列。我测试了: Collections.reverse (list); 它可以工作,不使用FlexboxLayou,但由于我的项目具有不同的布局,因此调整布局的最佳选项是使用FlexboxLayou。我尝试在recycleview上更改: app: stackFromEnd = "true" app: reverseLayout = "true" 没有任何效果。 我更改了FlexboxLay

我在我的项目中使用FlexboxLayou,但我无法反转从firebase获取的数据,我希望它按降序排列。我测试了:

Collections.reverse (list);
它可以工作,不使用FlexboxLayou,但由于我的项目具有不同的布局,因此调整布局的最佳选项是使用FlexboxLayou。我尝试在recycleview上更改:

app: stackFromEnd = "true"
app: reverseLayout = "true"
没有任何效果。 我更改了FlexboxLayou中的参数,但有些参数给出了一个错误

FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(context);
        flexboxLayoutManager.setFlexDirection(FlexDirection.ROW);
        flexboxLayoutManager.setJustifyContent(JustifyContent.CENTER);
        flexboxLayoutManager.setAlignItems(AlignItems.STRETCH);
        flexboxLayoutManager.setFlexWrap(FlexWrap.WRAP);
如果我将FlexWrap.WRAP更改为FlexWrap.WRAP\u,则适配器也会出现故障

使用Collections.reverse(列表)后出错:

给出适配器上的错误。
我做了一个很好的研究,但没有得到结果,我试图反转firebase接收到的内容,但主题非常复杂,我做不到。必须有一个简单的方法来做到这一点。

你找到解决方案了吗?你找到解决方案了吗?
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.pup, PID: 28144
    java.lang.ClassCastException: com.example.pup.Viewholder.Prop.ViewPropU cannot be cast to com.example.pup.Viewholder.Prop.ViewPropS
        at com.example.puplica.Adaptadores.AdapatadorProp.onBindViewHolder(AdapatadorProp.java:92)
        at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065)
        at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
        at com.google.android.flexbox.FlexboxLayoutManager.getFlexItemAt(FlexboxLayoutManager.java:456)
        at com.google.android.flexbox.FlexboxLayoutManager.getReorderedFlexItemAt(FlexboxLayoutManager.java:474)
        at com.google.android.flexbox.FlexboxHelper.calculateFlexLines(FlexboxHelper.java:429)
        at com.google.android.flexbox.FlexboxHelper.calculateHorizontalFlexLines(FlexboxHelper.java:249)
        at com.google.android.flexbox.FlexboxLayoutManager.updateFlexLines(FlexboxLayoutManager.java:953)
        at com.google.android.flexbox.FlexboxLayoutManager.onLayoutChildren(FlexboxLayoutManager.java:729)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851)
        at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1742)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:344)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:281)
        at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:3175)
        at android.view.View.layout(View.java:18010)
        at android.view.ViewGroup.layout(ViewGroup.java:5911)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2776)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2477)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1544)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7602)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
        at android.view.Choreographer.doCallbacks(Choreographer.java:686)
        at android.view.Choreographer.doFrame(