Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:45:32+00:00 2026-06-18T10:45:32+00:00

i am using ExpandableListFragment to create an ExpandableList inside a TabHost fragment i got

  • 0

i am using ExpandableListFragment to create an ExpandableList inside a TabHost fragment

i got the code for ExpandableListFragment from here https://gist.github.com/1316903

it seems to work fine except i cannot figure out how to change the text color.

my implementation looks like this

public class LocalListFragment extends ExpandableListFragment {

    private static final String NAME = "NAME";
    private static final String IS_EVEN = "IS_EVEN";

    private ArrayList<String> mGroups;
    private ArrayList<ArrayList<Song>> mChildren;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
        // Set up our adapter

        List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
        List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
        for (int i = 0; i < 10; i++) {
            Map<String, String> curGroupMap = new HashMap<String, String>();
            groupData.add(curGroupMap);
            curGroupMap.put(NAME, "GROUP" + i);
            //curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd");

            List<Map<String, String>> children = new ArrayList<Map<String, String>>();
            for (int j = 0; j < 5; j++) {
                Map<String, String> curChildMap = new HashMap<String, String>();
                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");
    }

}

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.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:45:34+00:00Added an answer on June 18, 2026 at 10:45 am

    just orverride getview method of list adapter :

    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 }){
    
    
                    @Override
                    public View getChildView(int groupPosition, int childPosition,
                            boolean isLastChild, View convertView, ViewGroup parent) {
    
                        TextView tv =  (TextView) super.getChildView(groupPosition, childPosition, isLastChild,convertView, parent);
                        //change background of tv here
                        return tv;
                    }
    
                    @Override
                    public View getGroupView(int groupPosition, boolean isExpanded,
                            View convertView, ViewGroup parent) {
                        // TODO Auto-generated method stub
                        TextView tv = (TextView) super.getGroupView(groupPosition, isExpanded, convertView, parent);
                        //change background of tv here
                        return tv;
                    }
    
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Android NDK is it possible (from native C-code) to get a list of
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using Play 2.1-RC1 I can't write simple test. Here's the action code: def echoTestTagFromXml
Using the example here as a starting point, I set out to customize my
Using jQuery, how do I get the value from a textbox and then load
Using intellij and maven pom files, how do i debug tests run inside the
Using this code, the following execution yields strange results: C 100 R W The
using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public
Using the DateTime class, if I try to run the following code: $mydate =
Using JQuery,Is there any possible to capture images/scanned documents from digital Camera/Scanner Connected to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.