我有一个图像查看其加载图片从firebase数据库的网址与毕加索图像加载器。我希望在firebase数据库url为空时隐藏imageview。如何设置imageview setvisibility在那个时候就消失了。
我的密码是
LoadData(categoryId);
}
private void LoadData(String categoryId) {
options = new FirebaseRecyclerOptions.Builder<TrollModel>().setQuery(MCC,TrollModel.class).build();
adapter = new FirebaseRecyclerAdapter<TrollModel, TrollViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull TrollViewHolder trollViewHolder, int i, @NonNull TrollModel trollModel) {
trollViewHolder.thrillername.setText(trollModel.getTitle());
Picasso.get().load(trollModel.getImage())
.into(trollViewHolder.thrillersimage);
trollViewHolder.setItemClickListner(new ItemClickListner() {
@Override
public void onClick(View view, int position, boolean isLongClick) {
Intent detailsIntent = new Intent(TrollActivity.this, TrollDetailActivity.class);
detailsIntent.putExtra("CategoryId", adapter.getRef(position).getKey());
startActivity(detailsIntent);
}
});
}
@NonNull
@Override
public TrollViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.troll_items, parent, false);
return new TrollViewHolder(v);
}
};
adapter.startListening();
recyclerView.setAdapter(adapter);
}
}
1条答案
按热度按时间xqkwcwgp1#
有
setVisibility()
每项功能View
在android中。你可以找到这个,如果你谷歌在正确的方式。请参阅下面的代码以解决您的问题。