Praveenkumar
Praveenkumar

Reputation: 24506

Listview with multiple checkbox and image View?

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.

Upvotes: 0

Views: 3342

Answers (2)

Vineet Shukla
Vineet Shukla

Reputation: 24031

Here is your architecture for your need:

  1. Get the installed application list.
  2. Implement a custom list adapter.

You can refer to this tutorial too.

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>

Upvotes: 1

Hitendra
Hitendra

Reputation: 3236

Here is the link with that you can bind checkbox and its stats. http://www.androidsnippets.com/clickable-listview-items Also you can handle click events for each of the view items added to listview.

Upvotes: 1

Related Questions