我无法在 Firebase 回收工具视图中使用滑动填充图片视图



我正在尝试使用图片网址填充Firebase的回收器视图。但它不起作用。很少有图像会自行改变。很少有人不显示。我不知道。可能是图片链接不正确。图片链接如下:github.com/GDGVIT/gdgvit.github.io/blob/new-website/members/Shiv.jpg?raw=true,https://scontent.fdel1-2.fna.fbcdn.net/v/t1.0-9/941872_1155868307766654_5025113179683551097_n.jpg?oh=f83c14f2bc3036ca9be144a08c35b58c&oe=58F02E42,http://drive.google.com/uc?export=view&id=0BzezVIpuqaxqS3ZzNW56bDJTN0E

网址中图像的大小重要吗?

public void onStart()
{
    super.onStart();
    View view=getView();
    mRef=new Firebase("https://gdg-vit-vellore-af543.firebaseio.com/managementmembers");
    mRecyclerView = (RecyclerView)view.findViewById(R.id.recycler_view_management_member);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    custom_font = Typeface.createFromAsset(getActivity().getAssets(),"fonts/Montserrat-Regular.ttf");
    FirebaseRecyclerAdapter<MemberModel,ManagementMemberFragment.MembersViewHolder> adapter=new FirebaseRecyclerAdapter<MemberModel,ManagementMemberFragment.MembersViewHolder>(
            MemberModel.class,
            R.layout.card_member,
            ManagementMemberFragment.MembersViewHolder.class,
            mRef.getRef()
    ) {
        @Override
        protected void populateViewHolder(ManagementMemberFragment.MembersViewHolder membersViewHolder, MemberModel memberModel, int i) {
            membersViewHolder.name.setTypeface(custom_font);
            membersViewHolder.work.setTypeface(custom_font);
            membersViewHolder.githubid.setTypeface(custom_font);
            membersViewHolder.profile_pic.setImageDrawable(null);
            membersViewHolder.name.setText(memberModel.getName());
            membersViewHolder.work.setText(memberModel.getWork());
            membersViewHolder.githubid.setText(memberModel.getGithubid());
            Log.v("From"+"management fragment",memberModel.getProfile_pic());
            Glide.with(getActivity()).load(memberModel.getProfile_pic()).thumbnail(0.4f).error(R.drawable.image_not_found).into(ManagementMemberFragment.MembersViewHolder.profile_pic);
        }
    };
    mRecyclerView.setAdapter(adapter);
}
public static class MembersViewHolder extends RecyclerView.ViewHolder{
    TextView name,work,githubid;
    static CircleImageView profile_pic;
    public MembersViewHolder(View v) {
        super(v);
        name=(TextView)v.findViewById(R.id.member_name);
        work=(TextView)v.findViewById(R.id.member_work);
        githubid=(TextView)v.findViewById(R.id.member_github_id);
        profile_pic=(CircleImageView)v.findViewById(R.id.member_image);
    }
}

请帮忙!!

profile_pic=(CircleImageView)v.findViewById(R.id.member_image);

确保"member_image"图像是正确的 XML 文件。我遇到了同样的问题,我发现错误的xml的ViewId。这导致了这个问题。

希望这有帮助

不要使用静态成员来保存 ViewHolder 中的任何视图:

static CircleImageView profile_pic;

使其成为实例成员,并通过 ViewHolder 引用它,就像任何其他视图一样。

相关内容

  • 没有找到相关文章

最新更新