recycler view is not working



  • Good afternoon, I'm in trouble. Tested the annex earlier on genymotion (nexus 4 android api 16), samsung gsiv (api 21), samsung gsiii (api 16), nexus 9 (api 23). Every device's working normally, decided to start a samsung gt-i8262 (api 16), why it didn't work in all RecyclerView. The markings are different, most of the root marks and the only part of this recyclerview, I don't see the possibilities of the problem at all, but the cover is not working. Has no one ever encountered such a problem?

    For example, I'm adding

    <android.support.v7.widget.RecyclerView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:background="@color/white"
        android:id="@+id/recycler"
        xmlns:android="http://schemas.android.com/apk/res/android" />
    

    The fragment in which the markings are used (more than the big one that has everything, and the adapter, and the cholera control).

    public class NewsFragment extends Fragment {
    
    int currentLastArticle = 0;
    int count;
    ArrayList&lt;Article&gt; news = new ArrayList&lt;&gt;();
    
    View view;
    RecyclerView rv;
    LinearLayoutManager llm;
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.recycler_view, container, false);
    
        rv = (RecyclerView) view.findViewById(R.id.recycler);
        llm = new LinearLayoutManager(activity);
        rv.setLayoutManager(llm);
        rv.addItemDecoration(new Divider(getActivity()));
        rv.setOnScrollListener(new EndlessRecyclerScrollListener(llm) {
            @Override
            public void onLoadMore(int current_page) {
                new GetNewsTask().execute(20, currentLastArticle+=20);
            }
        });
    
        new GetNewsTask().execute(20, currentLastArticle);
    
        return view;
    }
    
    class NewsRecyclerAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; {
    
        LayoutInflater inflater;
    
        public NewsRecyclerAdapter(Context context) {
            inflater = ((AppCompatActivity)context).getLayoutInflater();
        }
    
        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            return new NewsVH(inflater.inflate(R.layout.news_item, parent, false));
        }
    
        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
            ((NewsVH)holder).set(position);
        }
    
        @Override
        public int getItemCount() {
            return news.size();
        }
    
        private class NewsVH extends RecyclerView.ViewHolder{
    
            Text title;
            Text time;
            ImageView image;
            View itemView;
    
            public NewsVH(View itemView) {
                super(itemView);
                this.itemView = itemView;
                itemView.setPadding(
                        Decorator.getWidthBasedOnIPhone640(8),
                        Decorator.getHeightBasedOnIPhone960(8),
                        Decorator.getWidthBasedOnIPhone640(8),
                        Decorator.getHeightBasedOnIPhone960(8)
                );
                init(itemView);
            }
    
            private void init(View view) {
                title = (Text) view.findViewById(R.id.title);
                title.setTextSize(TypedValue.COMPLEX_UNIT_PX, Decorator.getHeightBasedOnIPhone960(24));
                Decorator.setMargins(title, 0, 8, 0, 0);
                time = (Text) view.findViewById(R.id.time);
                time.setTextSize(TypedValue.COMPLEX_UNIT_PX, Decorator.getHeightBasedOnIPhone960(20));
                time.setTextStyle(font.font133l);
                image = (ImageView) view.findViewById(R.id.image);
                image.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
                Decorator.setSquareSizeAndMargins(image, 176, 0, 0, 8, 8);
            }
    
            public void set(final int position) {
                Article article = news.get(position);
                title.setText(article.title());
                time.setText(article.time());
                String image = article.files().length == 0 ? "null" : article.files()[0].url480();
                ImageLoader.getInstance().displayImage(image, this.image, Decorator.getImageOptions(svg.zelen.drawable()));
                itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        ArticleFragment fragment = new ArticleFragment();
                        Bundle bundle = new Bundle();
                        bundle.putParcelable(getString(R.string.article), news.get(position));
                        fragment.setArguments(bundle);
                        activity.getSupportFragmentManager()
                                .beginTransaction()
                                .addToBackStack(Flags.CATALOG_BACKSTACK)
                                .replace(R.id.container, fragment, fragment.getClass().getCanonicalName())
                                .commit();
                    }
                });
            }
        }
    }
    
    class GetNewsTask extends AsyncTask&lt;Integer, String, JSONArray&gt; {
    
        int lowTreshold;
        int highTreshold;
    
        @Override
        protected void onPreExecute() {
            ((ProgressSwitcher)activity).showProgress();
        }
    
        @Override
        protected JSONArray doInBackground(Integer... params) {
            lowTreshold = params[1];
            highTreshold = params[0];
    
            String newsString = Web.httpGet(
                    Web.url.domain +
                            Web.url.content +
                            "/" +
                            highTreshold +
                            "/" +
                            lowTreshold
            );
    
            JSONArray jNewsArray = new JSONArray();
    
            try {
                JSONObject jNews = new JSONObject(newsString);
                jNewsArray = jNews.getJSONArray("content");
                count = jNews.getInt("count");
            } catch (JSONException e) {
                e.printStackTrace();
            }
    
    
            return jNewsArray;
        }
    
        @Override
        protected void onPostExecute(JSONArray jArray) {
            ((ProgressSwitcher)activity).hideProgress();
            int length = jArray.length();
            for (int i = 0; i &lt; length; i++) {
                try {
                    news.add(new Article(jArray.getJSONObject(i)));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            if (rv.getAdapter() == null) {
                rv.setAdapter(new NewsRecyclerAdapter(activity));
            } else {
                rv.getAdapter().notifyDataSetChanged();
            }
        }
    }
    

    }

    EDIT:

    He solved the problem last night. The problem was in a lost design and a long-standing attempt to solve one bug. I have a DrawerLayout, which, when pressurized on the ethema of NavigationDrawer, opens fragments. In one of the fragments, I was supposed to use the packagings (fergment - the string of the product, in the tabs of the commentary or a description of the product), the contents of the tobacco were opened in a separate container. Once the bang was cut, I got to the point where DrawerLayout placed the main container for fragments and a bacon in a scream, the height of which (and the fragment in it) was stubborn and dynamic (distance of the size of the mouse) so that the scrambled would not ble beyond the only case where we saw the contents. As a result, at the last samsong, I caught a bang of the function that considered the height of the scrubber because there was enough of one extra piccell to be free to chat, and I got in the annex the scrubbed View (RecyclerView) inside the stubby floating ScrollView, which led to the screen not to react at all my ges. As a result, I removed all the product &apos; s page in the product &apos; s page, and I received my share of happiness: () Thank you for participation and advice, and I am minus karma, for trying to break the challenge from the context that is important for her understanding.



  • According to the https://stackoverflow.com/a/28432632/3212712 Some of the mottos have changed the system slightly and staggered. It's possible to solve this with a dirty chaque - redefining the inactive vision and altering certain methods. In particular, there was a mistake in the method of reference in the logs. scrollTo()♪ Let's see how the reference changed that method, maybe help. Slowly - not in the method super.onScrollTo()




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2