firebaseArray descending order?

后端 未结 2 1894

Using firebaseArray, is it possible to order by a specified child key: (https://www.firebase.com/docs/web/guide/retrieving-data.html#section-queries)?

var fi         


        
2条回答
  •  借酒劲吻你
    2020-12-09 20:05

    This doesn't directly answer the original question, but for anyone using FirebaseUI Java/Android, with a RecyclerView, it's possible to order the RecyclerView in reverse, rather than using a query on Firebase:

    Example:

    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setReverseLayout(true);
    layoutManager.setStackFromEnd(true);
    recyclerView.setLayoutManager(layoutManager)
    

    (Ensuring you set both before adding the layout manager to the RecyclerView also)

    Github issue: https://github.com/firebase/FirebaseUI-Android/issues/90#issuecomment-230643303

提交回复
热议问题