Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>but you do understand that ExpandableListView work like what I asked you..? when you press on parent the parent expands (unless you state otherwise) and when you clikc on it again the parent collapses.. if you want to be able to expand the parent and also be able to check and uncheck the parent checkbox you need to give two views in the same row of the parent, the first is the checkbox and the second is the parent title (which can be empty like "") they should be side by side.</p> <p>you can do somthing like this:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Rl11" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:background="@drawable/desserts_main_expand" android:orientation="horizontal" &gt; &lt;ImageView android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:clickable="true" android:cropToPadding="true" android:padding="4dp" android:scaleType="fitXY" android:src="@android:drawable/ic_menu_add" /&gt; &lt;TextView android:id="@+id/ParentTextI" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:layout_toLeftOf="@+id/addIng" android:layout_toRightOf="@+id/Side_image" android:gravity="center_vertical" android:scrollHorizontally="true" android:text="dummy text" android:textAlignment="center" android:textColor="@color/white" android:textSize="20sp" android:textStyle="bold|italic" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>and then in the adapter:</p> <p>declare a global variable</p> <pre><code>CheckBox checkbox; </code></pre> <p>**this is only for the parent checkbox part</p> <pre><code>public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { checkbox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(checkbox.isChecked()=true) {checkbox.setChecked(false);} else checkbox.setChecked(true); ParentActivity.checkall(); } }); </code></pre> <p>and then in ParentActivity:</p> <p>add a function that checks every child of the same parent:</p> <pre><code>public static void checkall() { for(int j=0 ; j&lt;files.size() ; j++) {if (listAdapter.checkbox.isChecked()==true) {files.get(j).setChecked(true)}; } </code></pre> <p>I have made the code specially for you so there might be some error cause i havnt checked it.. but it supposed to be somthing like this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload