我使用Recyclerview加载200多个数据以在家中显示 页。
Volley最初需要3分钟的装载机,然后是三到四个 秒,Recycler视图在adapter.So中加载200多个数据 完全加载图像内容需要7秒钟才能显示 它在主页的UI中。
但是我必须在三秒内加载图像。它可以吗? 如果我对此有任何建议,对我有帮助。
HomeActivity.java:
if(createdBy.equals("event")){
String eventName = jsonObject.getString("name");
String eventDate = jsonObject.getString("event_date");
String eventMonthYear = jsonObject.getString("event_date_year");
String eventLocation = jsonObject.getString("location");
homePostItems.setEventPost(createdBy);
homePostItems.setEventName(eventName);
homePostItems.setEventDate(eventDate);
homePostItems.setEventMonthYear(eventMonthYear);
homePostItems.setEventLocation(eventLocation);
}
if(createdBy.equals("post")){
homePostItems.setPostData(createdBy);
}
homePostItems.setSharePopup("socialAndGolive");
homePostItemsList.add(homePostItems);
homePostitemsAdapter.notifyDataSetChanged();
HomeAdapter.java:
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
if (rowItem.getEventPost() != null) {
if (rowItem.getEventPost().equals("event")) {
holder.rlPostItems.setVisibility(View.GONE);
holder.ivPostFlag.setVisibility(View.GONE);
holder.userMenuImage.setVisibility(View.GONE);
holder.ivPostedImage.setClickable(false);
holder.rlEventDetails.setVisibility(View.VISIBLE);
holder.tvSubtitle.setText("Event");
holder.tvDateEvent.setText(rowItem.getEventDate());
holder.tvMonthYearEvent.setText(rowItem.getEventMonthYear());
holder.tvNameEvent.setText(rowItem.getEventName());
holder.tvAddressEvent.setText(rowItem.getEventLocation());
Typeface typeDate = Typeface.createFromAsset(context.getAssets(), "kausan.otf");
holder.tvDateEvent.setTypeface(typeDate);
Typeface typeName = Typeface.createFromAsset(context.getAssets(), "abz.ttf");
holder.tvMonthYearEvent.setTypeface(typeName);
} else {
holder.rlEventDetails.setVisibility(View.GONE);
}
} else {
holder.rlEventDetails.setVisibility(View.GONE);
}
}