Listview with multiple checkbox and image View?

前端 未结 2 1259
野的像风
野的像风 2021-01-27 05:54

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

相关标签:
2条回答
  • 2021-01-27 06:07

    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>
    
    0 讨论(0)
  • 2021-01-27 06:22

    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.

    0 讨论(0)
提交回复
热议问题