列表视图与多个复选框和图像查看? [英] Listview with multiple checkbox and image View?

查看:47
本文介绍了列表视图与多个复选框和图像查看?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个显示在列表视图将包含多个复选框中安装的应用程序(和它们的图标)的应用程序。我怎样才能做到这一点?如果有可能,请告诉我的方式。我知道这例如了解列表视图与多个复选框。是否有可能实现这个应用程序与ImageView的?先感谢。

I am going to create an application for displaying the installed applications (and their icons) in a listview which will contain multiple checkboxes. How can I do this? If it's possible, please tell me the way. I knew about this example for listview with multiple checkboxes. Is it possible to implement this application with an imageview? Advance thanks.

推荐答案

下面是你的架构您的需要:

Here is your architecture for your need:

  1. 获取已安装的应用程序列表。
  2. 实现自定义列表适配器。

您可以参考本教程了。

您的XML定制名单适配器是这样的:

Your xml for custom list adapter will be like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width = "fill_parent"
    android:layout_height = "wrap_content"
    android:padding = "10dp" >

<ImageView
    android:id = "@+id/image_icon"
    android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:layout_alignParentLeft = "true" />

<TextView
    android:id = "@+id/txt_name"
    android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:textSize = "15dp"
    android:textColor = "@color/white"
    android:layout_toRightOf = "@+id/image_icon"
    android:layout_marginLeft = "8dp"
    android:maxLength = "20"
    android:ellipsize = "marquee" />

<CheckBox
    android:id = "@+id/item_check"
    android:layout_width = "wrap_content"
    android:layout_height = "wrap_content"
    android:layout_alignParentRight = "true"
    android:button = "@drawable/btn_checkbox_selector"
    android:layout_marginRight = "10dp"
    android:clickable = "true" />

</RelativeLayout>

这篇关于列表视图与多个复选框和图像查看?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆