【问题标题】:how to show image from device in gridview with dates in android如何在gridview中显示来自设备的图像以及android中的日期
【发布时间】:2016-12-21 16:07:11
【问题描述】:

我正在 android 中制作图片库。我使用了可以在gridview中显示图像的gridview。但是,我无法显示带有标题日期的图像。然后,根据日期显示图像。我试图用文本视图在布局中显示图像。但是,它不起作用。请任何人都可以帮助我。如何显示如下图所示的图像。

@Override
public View getView(final int position, View convertView, ViewGroup parent) {


    String appName;
    String name = null;

    //LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);


    View row = convertView;
    Holder holder = null;

    if (row == null) {
        //convertView.getRecycledViewPool().setMaxRecycledViews(VIEW_TYPE,0);
        //gridView = new View(context);

        // get layout from mobile.xml
        row = mInflater.inflate(R.layout.appsgridview, null);
        holder = new Holder();
        holder.appIcon = (ImageView)row.findViewById(R.id.imageView);

        holder.ckbox =(CheckBox)row.findViewById(R.id.checkBox);
        holder.textView=(TextView)row.findViewById(R.id.text);


        row.setTag(holder);
    } else {

        holder = (Holder) convertView.getTag();
        holder.ckbox.setOnCheckedChangeListener(null);

    }

        holder.ckbox.setFocusable(false);
        PackageInfo packInfo = packList.get(position);
        ApplicationInfo packinfo=packages.get(position);
        String namep=packinfo.name;
        appName = packInfo.applicationInfo.loadLabel(context.getPackageManager()).toString();

       holder.textView.setText(appName);
       holder.appIcon.setImageDrawable(packInfo.applicationInfo.loadIcon(context.getPackageManager()));
       holder.ckbox.setChecked(positionArray.get(position));
    return row;
}

【问题讨论】:

标签: java android gridview


【解决方案1】:

您可以使用StickyGridHeaders 之类的东西,您可以将日期作为标题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-15
    • 2019-05-24
    • 1970-01-01
    • 1970-01-01
    • 2017-02-26
    • 2017-01-07
    相关资源
    最近更新 更多