2017-02-01 111 views
0

我正嘗試使用圖像網址填充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=58F02E42http://drive.google.com/uc?export=view&id=0BzezVIpuqaxqS3ZzNW56bDJTN0E我無法在Firebase回收站視圖中使用Glide填充圖像視圖

做圖像的大小url的問題?

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

請幫忙!!!

+0

我認爲你的一些環節需要爲什麼它不工作這就是身份驗證,上載火力存儲您的圖像生成它像「https://firebasestorage.googleapis.com/b/bucket/o鏈接/images%20stars.jpg「使用此鏈接顯示圖像。有關更多詳細信息,請從Firebase存儲中讀取下載文件https://firebase.google.com/docs/storage/android/download-files –

回答

0

不要使用靜態成員持有一個ViewHolder任何觀點:

static CircleImageView profile_pic; 

使它成爲一個實例成員,並通過ViewHolder參考就像任何其他視圖參考。

1

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

確保「member_image」圖像是正確的xml文件。我遇到了同樣的問題,我找到了錯誤的XML的ViewId。這是造成這個問題。

希望這有助於

相關問題