当前位置:编程学习 > wap >>

类似android qq一样的可以收缩的listview怎么弄啊

类似android qq一样的可以收缩的listview,收缩栏可以自定义颜色。请问应该怎么写啊!请高手不吝赐教。谢谢啦!!! --------------------编程问答-------------------- 收缩?是指ExpandableListView吗?
自定义颜色什么的是自己重写Adapter吧 --------------------编程问答-------------------- 你说的应该是树控件ExpandableListView --------------------编程问答-------------------- ExpandableListActivity这个控件可是实现ListView,然后每个还可以点开。具体写法可以参考源码里面的例子。 --------------------编程问答-------------------- ExpandableListActivity写过。现在要把ExpandableListActivity写到一个TabHost里面。能给点思路吗? --------------------编程问答--------------------



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;
}

--------------------编程问答-------------------- 通过popWindow 可以实现 --------------------编程问答-------------------- --------------------编程问答--------------------
引用 5 楼 pang68599 的回复:
Java code



    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //1>.得到一个TabHost
    ……

--------------------编程问答-------------------- 我先来试一下这个代码 --------------------编程问答-------------------- LS的强...
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,