Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android recyclerview with volley加载更多数据并将其显示到UI中需要更多时间_Android_Android Recyclerview - Fatal编程技术网

Android recyclerview with volley加载更多数据并将其显示到UI中需要更多时间

Android recyclerview with volley加载更多数据并将其显示到UI中需要更多时间,android,android-recyclerview,Android,Android Recyclerview,我正在使用Recyclerview加载200多个数据,以便在家中显示 页面 截击开始需要3分钟,然后三比四 秒,recycler视图在适配器中加载200多个数据 加载要显示的图像内容总共需要7秒钟 将其导入主页的UI中 但我必须在三秒钟内加载图像。有可能吗? 如果我得到任何关于这方面的建议,这将对我有所帮助 HomeActivity.java: if(createdBy.equals("event")){ String eventName = json

我正在使用Recyclerview加载200多个数据,以便在家中显示 页面

  • 截击开始需要3分钟,然后三比四 秒,recycler视图在适配器中加载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();
    
     @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);
        }
      }
    
    HomeAdapter.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();
    
     @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);
        }
      }
    
    • 未加载所有图像的回收器视图的实际过程 最初。例如,我有300多张图像要加载 主页

    • Recyclerview最初不会加载所有图像。我使用
      NestedSCrollView
      在recyclerview内部。这样所有300个图像都将 最初加载。加载主页又花了7秒钟

    • 删除嵌套滚动视图解决了我的问题。您可以参考 和 了解何时使用recyclerview进行寻呼也不工作时 使用嵌套滚动视图

        • 未加载所有图像的回收器视图的实际过程 最初。例如,我有300多张图像要加载 主页

        • Recyclerview最初不会加载所有图像。我使用
          NestedSCrollView
          在recyclerview内部。这样所有300个图像都将 最初加载。加载主页又花了7秒钟

        • 删除嵌套滚动视图解决了我的问题。您可以参考 和 了解何时使用recyclerview进行寻呼也不工作时 使用嵌套滚动视图


        不要一次加载200个项目,只加载足以填充您的Recyclerview的数据,然后当用户滚动到它时,这是另一次下载另一批数据,直到您完成200个项目。当用户没有滚动那么多时,就没有必要完成所有200个项目的下载。@Enzokie ok。让我试试这个建议并告诉你。不要一次加载200个项目,只加载足以填充你的Recyclerview的数据,然后,当用户滚动到它,这是另一个时间下载另一批数据,直到您完成您的200个项目。如果用户没有滚动那么多,那么就没有必要下载全部200个项目。@Enzokie好的。让我试试这个建议,然后告诉你。