有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

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

当我在firebase查询中使用equalTo时,我的listview不再滚动

当我不使用equalTo(参见注释的查询)时,我的listview滚动是正常的

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);

我的数据库:

My db :

屏幕:

screen

知道吗


共 (0) 个答案