android– 在列表视图中查看寻呼机?

android– 在列表视图中查看寻呼机?,第1张

概述我在listview项目中使用viewpager.我想在视图寻呼机中显示图像,但延迟加载不能使用它.请给我任何解决方案.我尝试了很多延迟加载文件,但有些正在运行.有些人持有UI.我现在使用的代码工作正常,但没有第一次显示图像.我必须向下滚动列表视图然后向上滚动然后才显示.我不知道有什么

我在ListvIEw项目中使用vIEw pager.我想在视图寻呼机中显示图像,但延迟加载不能使用它.请给我任何解决方案.我尝试了很多延迟加载文件,但有些正在运行.有些人持有UI.

我现在使用的代码工作正常,但没有第一次显示图像.我必须向下滚动列表视图然后向上滚动然后才显示.我不知道有什么问题请给我解决一下我要做的事情?

我发布我的适配器代码: –

这是我的getvIEw代码:

public VIEw getVIEw(final int position, VIEw convertVIEw, VIEwGroup parent) {        VIEw v = convertVIEw;        if (v == null) {            LayoutInflater mInflater = (LayoutInflater) objProp.activity                    .getApplicationContext().getSystemService(                            Context.LAYOUT_INFLATER_SERVICE);            v = mInflater.inflate(R.layout.adapter_walllayout, null);        }        // Get Controls        final vIEwHolder vh = new vIEwHolder();        vh.txtvIEw_Question = (TextVIEw) v.findVIEwByID(R.ID.textVIEw1);        vh.textvIEw_CommentCount = (TextVIEw) v                .findVIEwByID(R.ID.textVew_WallTotalComments);        vh.textvIEw_likeCount = (TextVIEw) v                .findVIEwByID(R.ID.textVew_WallTotalokay);        vh.VIEwPager_Images = (VIEwPager) v.findVIEwByID(R.ID.pager);        vh.imagevIEw_Profile = (ImageVIEw) v                .findVIEwByID(R.ID.imagevIEw_userImage);        vh.textvIEw_PostDate = (TextVIEw) v                .findVIEwByID(R.ID.textVIEw_PostDate);        vh.textvIEw_Username = (TextVIEw) v                .findVIEwByID(R.ID.textVew_WallUsername);        // SetDatato controls        // Set Data        vh.txtvIEw_Question                .setText(objProp.wallDataList.get(position).wallPost_name);        vh.txtvIEw_Question.setTypeface(FontsFamily.getFont(                objProp.activity.getApplicationContext(), true));        vh.textvIEw_Username                .setText(objProp.wallDataList.get(position).wallPost_User_name);        vh.textvIEw_Username.setTypeface(FontsFamily.getFont(                objProp.activity.getApplicationContext(), true));        final Vector<VIEw> pages = new Vector<VIEw>();        objProp.activity.runOnUiThread(new Runnable() {            @OverrIDe            public voID run() {                vh.VIEwPager_Images.setoffscreenPagelimit(4);                for (int i = 0; i < objProp.wallDataList.get(position).wallPost_Images_Data                        .size(); i++) {                    final int imagePosion = i;                    LayoutInflater mInflaterImage = (LayoutInflater) objProp.activity                            .getApplicationContext().getSystemService(                                    Context.LAYOUT_INFLATER_SERVICE);                    VIEw vImage = mInflaterImage.inflate(                            R.layout.wallimagepageradaper, null);                    ImageVIEw imageVIEw = (ImageVIEw) vImage                            .findVIEwByID(R.ID.imageVIEw1);                    imageVIEw.setTag(objProp.wallDataList.get(position).wallPost_Images_Data                            .get(i).qst_Wall_Image);                    CheckBox chk = (CheckBox) vImage                            .findVIEwByID(R.ID.checkBox1);                    /*                     * loadLooksImages.fetchDrawableOnThread(objProp.wallDataList                     * .get(position).wallPost_Images_Data                     * .get(i).qst_Wall_Image, imageVIEw);                     */                    imageLoader_relativeLayout.displayImage(                            objProp.wallDataList.get(position).wallPost_Images_Data                                    .get(i).qst_Wall_Image, imageVIEw);                    /*imageLoader_relativeLayout.displayImage(                            objProp.wallDataList.get(position).wallPost_Images_Data                                    .get(i).qst_Wall_Image, imageVIEw);                     */                    // Get Controls                    vh.percentageLayout = (relativeLayout) vImage                            .findVIEwByID(R.ID.layoutPercent);                     vh.percentageLayout.setVisibility(VIEw.GONE);                    vh.percentageLayout.setID(objProp.wallDataList                            .get(position).wallPost_Images_Data                            .get(imagePosion).qst_Wall_ImageID);                    vh.textVIEw_Percentage = (TextVIEw) vImage                            .findVIEwByID(R.ID.textVIEw_PercentCount);                    vh.textVIEw_percentVoteCount = (TextVIEw) vImage                            .findVIEwByID(R.ID.textVIEw1_PercentVoteCount);                    // Set Data                    Double d = Double.parseDouble(objProp.wallDataList                            .get(position).wallPost_Images_Data.get(i).qst_Wall_Image_Percentage);                    int val = d.intValue();                    vh.textVIEw_Percentage.setText(val + "%");                    vh.textVIEw_Percentage.setTypeface(FontsFamily.getFont(                            objProp.activity.getApplicationContext(), true));                    vh.textVIEw_percentVoteCount.setTypeface(FontsFamily                            .getFont(objProp.activity.getApplicationContext(),                                    true));                    vh.textVIEw_percentVoteCount.setText(objProp.wallDataList                            .get(position).wallPost_Images_Data.get(i).qst_Wall_Image_likeCount                            + " Votes");                    chk.setonCheckedchangelistener(new OnCheckedchangelistener() {                        @OverrIDe                        public voID onCheckedChanged(Compoundbutton buttonVIEw,                                boolean isChecked) {                            new Service_likeImage(objProp.activity)                                    .execute(objProp.wallDataList.get(position).wallPost_Images_Data                                            .get(imagePosion).qst_Wall_ImageID                                            + "");                            relativeLayout lay = (relativeLayout) objProp.activity                                    .findVIEwByID(objProp.wallDataList                                            .get(position).wallPost_Images_Data                                            .get(imagePosion).qst_Wall_ImageID);                            lay.setVisibility(VIEw.VISIBLE);                        }                    });                    // //system.out.println("OKKKKKK "+i);                    pages.add(vImage);                }            }        });        // system.out.println("aaa  "+pages.size());        CustomPagerAdapter adap = new CustomPagerAdapter(                objProp.activity.getApplicationContext(), pages);        vh.VIEwPager_Images.setAdapter(adap);        vh.textvIEw_CommentCount.setonClickListener(new OnClickListener() {            @OverrIDe            public voID onClick(VIEw v) {                Intent intent = new Intent(objProp.activity, OkayComments.class);                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                intent.putExtra("wallPostposition", position);                intent.putExtra("imageNumber", imagePsotioninPager);                objProp.activity.startActivity(intent);            }        });        vh.textvIEw_likeCount.setonClickListener(new OnClickListener() {            @OverrIDe            public voID onClick(VIEw v) {                Intent intent = new Intent(objProp.activity, Results.class);                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                intent.putExtra("qcode",                        objProp.wallDataList.get(position).wallPost_ID);                objProp.activity.startActivity(intent);            }        });        imageLoader.displayImage(                objProp.wallDataList.get(position).wallPost_User_Image,                vh.imagevIEw_Profile);        String totComments = objProp.wallDataList.get(position).wallPost_Images_Data                .get(0).qst_Wall_Image_CommentCount + "";        vh.textvIEw_CommentCount.setText(totComments + " Comments");        vh.textvIEw_CommentCount.setTypeface(FontsFamily.getFont(                objProp.activity.getApplicationContext(), true));        vh.textvIEw_likeCount                .setText(objProp.wallDataList.get(position).wallPost_Images_Data                        .get(0).qst_Wall_Image_likeCount + " Okay");        vh.textvIEw_likeCount.setTypeface(FontsFamily.getFont(                objProp.activity.getApplicationContext(), true));        return v;    }    public class vIEwHolder {        TextVIEw txtvIEw_Question;        TextVIEw textvIEw_CommentCount;        TextVIEw textvIEw_likeCount;        TextVIEw textvIEw_Username;        TextVIEw textvIEw_PostDate;        VIEwPager VIEwPager_Images;        ImageVIEw imagevIEw_Profile;        TextVIEw textVIEw_Percentage;        TextVIEw textVIEw_percentVoteCount;        relativeLayout percentageLayout;        // Image in VIEwPager        ImageVIEw imageVIEw_Postimage;    }

解决方法:

首先……我不太确定这有多严重,因为你试图使用vIEw pager作为列表视图项.这并不是说它无法实现,而只是在这里有太多的层次.希望你会欣赏这段代码的工作和努力,我希望这将有助于解决你的问题.所以请享受代码.. 总结

以上是内存溢出为你收集整理的android – 在列表视图中查看寻呼机?全部内容,希望文章能够帮你解决android – 在列表视图中查看寻呼机?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1103156.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存