Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to change text color in SimpleExpandableListAdapter
    primarykey
    data
    text
    <p>i am using ExpandableListFragment to create an ExpandableList inside a TabHost fragment</p> <p>i got the code for ExpandableListFragment from here <a href="https://gist.github.com/1316903" rel="nofollow">https://gist.github.com/1316903</a></p> <p>it seems to work fine except i cannot figure out how to change the text color. </p> <p>my implementation looks like this</p> <pre><code>public class LocalListFragment extends ExpandableListFragment { private static final String NAME = "NAME"; private static final String IS_EVEN = "IS_EVEN"; private ArrayList&lt;String&gt; mGroups; private ArrayList&lt;ArrayList&lt;Song&gt;&gt; mChildren; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { // Set up our adapter List&lt;Map&lt;String, String&gt;&gt; groupData = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); List&lt;List&lt;Map&lt;String, String&gt;&gt;&gt; childData = new ArrayList&lt;List&lt;Map&lt;String, String&gt;&gt;&gt;(); for (int i = 0; i &lt; 10; i++) { Map&lt;String, String&gt; curGroupMap = new HashMap&lt;String, String&gt;(); groupData.add(curGroupMap); curGroupMap.put(NAME, "GROUP" + i); //curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd"); List&lt;Map&lt;String, String&gt;&gt; children = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); for (int j = 0; j &lt; 5; j++) { Map&lt;String, String&gt; curChildMap = new HashMap&lt;String, String&gt;(); children.add(curChildMap); curChildMap.put(IS_EVEN, "Child " + j); } childData.add(children); } mAdapter = new SimpleExpandableListAdapter( getActivity().getApplicationContext(), groupData, android.R.layout.simple_expandable_list_item_1, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 }, childData, android.R.layout.simple_expandable_list_item_2, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 } ); //TextView tv = (TextView)getActivity().findViewById(android.R.id.text1); //tv.setTextColor(0xffff0000); setListAdapter(mAdapter); return super.onCreateView(inflater, container, savedInstanceState); } @Override public void onListItemClick(ListView l, View v, int position, long id) { Log.i("TAG", "Item selected"); } } </code></pre> <p>my guess is that the lines 'new int[] { android.R.id.text1, android.R.id.text2 },' has a lot to do with it but i'm a bit confused about this.</p> <p>can someone please help? do i need to creat new TextView id's and specify textColor? i tried but couldn't figure it out. thanks.</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.
 

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