在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Android/ 請(qǐng)教一個(gè)分頁(yè)加載數(shù)據(jù)的問(wèn)題

請(qǐng)教一個(gè)分頁(yè)加載數(shù)據(jù)的問(wèn)題

模擬器可以加載更多數(shù)據(jù),手機(jī)不行.就是用RecyclerView上拉加載更多數(shù)據(jù),手機(jī)和模擬器都正常聯(lián)網(wǎng),加載更多是獲取列表初始數(shù)據(jù)然后在Hanlder設(shè)置Adpater之后觸發(fā)的,模擬器可以正常觸發(fā)加載更多,真機(jī)不行.Hanlder里面我是這樣寫(xiě)的:

               case SHOW_SEARCH_SUCCESS://手動(dòng)搜索成功
                    mLoading.setVisibility(View.GONE);
                    mNoSearchStatus.setVisibility(View.GONE);
                    mSearching.setVisibility(View.VISIBLE);
                    mNoSearchResult.setVisibility(View.GONE);
                    mHavaResult.setVisibility(View.VISIBLE);

                    //搜索結(jié)果的RadioButton
                    ColorStateList csl = getResources().getColorStateList(R.color.button_text);//動(dòng)態(tài)加載的RadioButton必須這樣設(shè)置文字選中和普通顏色
                    //頂部按鈕
                    for (int i = 0; i < resultTitles.length; i++) {
                        RadioButton tempButton = new RadioButton(SearchActivity.this);
                        tempButton.setTextColor(csl);//動(dòng)態(tài)加載的RadioButton必須這樣設(shè)置文字選中和普通顏色
                        tempButton.setButtonDrawable(null);           // 設(shè)置按鈕的樣式
                        tempButton.setText(resultTitles[i]);
                        tempButton.setId(i);
                        tempButton.setTextSize(15);
                        tempButton.setButtonDrawable(R.drawable.channel_button_shape);
                        tempButton.setPadding(30, 0, 30, 0);
                        tempButton.setBackgroundResource(R.drawable.channel_title_selector);
                        tempButton.setGravity(Gravity.CENTER);
                        RadioGroup.LayoutParams lp = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                                ViewGroup.LayoutParams.WRAP_CONTENT);
                        lp.setMargins(15, 0, 15, 0);//設(shè)置RadioButton的邊距
//                        mRadioGroup.addView(tempButton, lp);//TODO:臨時(shí)不顯示頂部按鈕
                        if (i == 0) {
                            mRadioGroup.check(tempButton.getId());
                        }
                    }
                    //加載頁(yè)面數(shù)據(jù)
                    mPageDatas = new ArrayList<>();
                    for (int i = 0; i < resultTitles.length; i++) {
                        mPageDatas.add(new SearchResultController(SearchActivity.this));//頂部有多少個(gè)RadioButton,ViewPager頁(yè)面就添加多少個(gè)
                    }
                    //首次進(jìn)來(lái)默認(rèn)獲取第一個(gè)RadioButton的數(shù)據(jù)
//                    getListData(0);
                    mViewPager.setAdapter(mPagerAdapter);
                    mRadioGroup.setOnCheckedChangeListener(SearchActivity.this);
                    mViewPager.addOnPageChangeListener(SearchActivity.this);
                    mPagerAdapter.notifyDataSetChanged();

                    TabController tabController = mPageDatas.get(0);
                    View rootView = tabController.getRootView();
                    RecyclerView recyclerView = rootView.findViewById(R.id.rv_have_result);
                    //創(chuàng)建布局管理
                    LinearLayoutManager layoutManager = new LinearLayoutManager(SearchActivity.this);
                    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
                    recyclerView.setLayoutManager(layoutManager);
                    searchHaveResultAdapter = new SearchResultAdapter(R.layout.item_search_have_result, mHavaResultDatas, SearchActivity.this);
                    recyclerView.setAdapter(searchHaveResultAdapter);

                    searchHaveResultAdapter.setOnLoadMoreListener(SearchActivity.this);//加載更多數(shù)據(jù)
                    break;
回答
編輯回答
懶豬

已自行解決問(wèn)題

2017年5月27日 19:42