类似android qq一样的可以收缩的listview,收缩栏可以自定义颜色。请问应该怎么写啊!请高手不吝赐教。谢谢啦!!!

解决方案 »

  1.   

    收缩?是指ExpandableListView吗?
    自定义颜色什么的是自己重写Adapter吧
      

  2.   

    你说的应该是树控件ExpandableListView
      

  3.   

    ExpandableListActivity这个控件可是实现ListView,然后每个还可以点开。具体写法可以参考源码里面的例子。
      

  4.   

    ExpandableListActivity写过。现在要把ExpandableListActivity写到一个TabHost里面。能给点思路吗?
      

  5.   


    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //1>.得到一个TabHost
    TabHost tabHost = getTabHost();

    //2>.加入ExpandableListActivity
    tabHost.addTab(this.buildTabSpec(tabHost, new Intent().setClass(this,ExpandableListActivity.class ),
    this.getString(R.string.mp3_list_remote), 0));
    //2>.加入ExpandableListActivity
    tabHost.addTab(this.buildTabSpec(tabHost, new Intent().setClass(this,ExpandableListActivity.class ), 
    this.getString(R.string.mp3_list_local), 0));


    }
    /**
     * 构建一个TabSpec
     * @return
     */
    private TabHost.TabSpec  buildTabSpec(TabHost tabHost,Intent intent ,String title, int pic) { //1>.代表一个TabHost一个页面
    TabHost.TabSpec tabSpec = tabHost.newTabSpec(title); //2>.获得系统默认图片
    Resources res = getResources();
    //3.设置一个Indicator,如果pic为0就设置为默认图片
    tabSpec.setIndicator(title,res.getDrawable( 0 == pic ? android.R.drawable.stat_sys_download : pic ));
    //4>.设置remoteSpec的内容,就是一个intent内容
    tabSpec.setContent(intent);

    return tabSpec;
    }