java-Listview不使用Firebase查询“ equalTo”滚动

当我在firebase查询上使用equalTo时,我的列表视图不再滚动.

当我不使用equalTo时(请参阅注释的查询),我的列表视图滚动就可以了.

final ListView list_matchs_win = findViewById(R.id.list_matchs_win);
Query queryWin = FirebaseDatabase.getInstance().getReference("Match").orderByChild("winner/name").equalTo(player.getName());
//Query queryWin = FirebaseDatabase.getInstance().getReference("Match").orderByChild("winner/name");
FirebaseListOptions<Match> optionsWin = new FirebaseListOptions.Builder<Match>()
        .setLayout(R.layout.listematchs_item)
        .setQuery(queryWin,Match.class)
        .build();
adapterWin = new FirebaseListAdapter(optionsWin) {
    @Override
    protected void populateView(View v,Object model,int position) {
        TextView date = v.findViewById(R.id.date);
        ImageView photo_winner = v.findViewById(R.id.photo_winner);
        TextView name_winner = v.findViewById(R.id.name_winner);
        ImageView photo_looser = v.findViewById(R.id.photo_looser);
        TextView name_looser = v.findViewById(R.id.name_looser);

        Match match = (Match) model;
        date.setText(match.getDate());
        Picasso.get().load(match.getWinner().getPhoto()).into(photo_winner);
        name_winner.setText(match.getWinner().getName());
        Picasso.get().load(match.getLooser().getPhoto()).into(photo_looser);
        name_looser.setText(match.getLooser().toString());
    }
};
//list_matchs_win.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
//list_matchs_win.setScrollY(adapterWin.getCount()-1);
list_matchs_win.setAdapter(adapterWin);

我的数据库:

屏幕:

任何想法 ?

最佳答案
请在if部分&中设置适配器.也可以在else部分中获取现有适配器,并再次使用get方法进行设置,以确保可以正常工作.

相关文章

AdvserView.java package com.earen.viewflipper; import an...
ImageView的scaleType的属性有好几种,分别是matrix(默认)...
文章浏览阅读8.8k次,点赞9次,收藏20次。本文操作环境:win1...
文章浏览阅读1.2w次,点赞15次,收藏69次。实现目的:由main...
文章浏览阅读3.8w次。前言:最近在找Android上的全局代理软件...
文章浏览阅读2.5w次,点赞17次,收藏6次。创建项目后,运行项...