Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't believe you can do that since (as you guess) the layouts would have to have duplicate ids, and I don't think that's allowed.</p> <p>Instead of trying to use two different layouts, why don't you use a single one and then override the <code>bindChildView</code> from the <code>ExpandableListAdapter</code> and change the colors in there?</p> <p>A small sample from one of my projects (edited to condense it to a managable block):</p> <pre><code> protected void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) { TextView name = (TextView) view.findViewById(R.id.ListItem1); TextView qty = (TextView) view.findViewById(R.id.ListItem3); name.setTextColor(GroceryApplication.shoplistitem_name); qty.setTextColor(GroceryApplication.shoplistitem_qty); name.setText(cursor.getString(2)); qty.setText(cursor.getString(1)); if (cursor.getInt(5) == 1) { name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); qty.setPaintFlags(qty.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); view.setBackgroundResource(R.color.purchased); } else { name.setPaintFlags(name.getPaintFlags() &amp; ~Paint.STRIKE_THRU_TEXT_FLAG); qty.setPaintFlags(qty.getPaintFlags() &amp; ~Paint.STRIKE_THRU_TEXT_FLAG); view.setBackgroundResource(R.color.black); } } } </code></pre> <p>The above code uses a flag in the db which will cause the app to either change the background to gray and the text to be strikethrough style or have the background color be my default color and cancel the strikethrough text.</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.
 

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