我有我的火力点名单适配器如下与卡片视图使用火力地堡列表适配器
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
mListview = (ListView) findViewById(R.id.listview);
mAuth = FirebaseAuth.getInstance();
//the post list shit is happening here
DatabaseReference root = FirebaseDatabase.getInstance().getReference();
FirebaseUser user = mAuth.getCurrentUser();
DatabaseReference postRef = root.child("users").child(user.getUid().toString()).child("posts");
ListAdapter adapter = new FirebaseListAdapter<PostList>(this,PostList.class,android.R.layout.simple_list_item_1,postRef) {
@Override
protected void populateView(View view, PostList postList, int i) {
TextView text = (TextView)view.findViewById(android.R.id.text1);
text.setText(postList.getBody());
}
};
mListview.setAdapter(adapter);
我有一个列表视图正常的XML和与它的卡片视图另一个XML
我的问题是,我不能找到一种方法,涉及我cardview的xml文件到我的活动,所以我的列表只是不停地显示为正常列表, 在初始化火力名单适配器,我发现了一个R.layout_simple_list_item
林不知道这究竟是如何工作的,我用Google搜索,没有什么可以解释为什么我不能只说改为。另外,请让我知道,如果我这样做是错误的。
如果您使用CardView,我建议您改用FirebaseRecyclerAdapter。 – Linxy
你能指出我的任何好的教程,从火力位置回收适配器,而不是一些静态数组专门处理 – Mordred
从这里安装FirebaseRecyclerAdapter:https://github.com/firebase/FirebaseUI-Android,然后有一个完整的教程藏汉:https://github.com/firebase/FirebaseUI-Android/blob/master/database/README.md – Linxy