当我在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);
我的数据库:
屏幕:
任何想法 ?
最佳答案