package C_ExpandableListView.C_ExpandableListView;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.TextView;
public class C_ExpandableListView extends Activity {
ExpandableListView expandableList;
public String[] str1 = { "好友", "同学", "亲戚" };
public String[] str2 = { "大龙虾", "小土豆","肥螃蟹", "瘦辣椒", "烂芋头" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
expandableList = (ExpandableListView) C_ExpandableListView.this.findViewById(R.id.ExpandableListView01);
expandableList.setAdapter(new TreeViewAdapter(this));
}
public class TreeViewAdapter extends BaseExpandableListAdapter {
private LayoutInflater inflater;
private LayoutInflater inflater1;
public TreeViewAdapter(Context c) {
this.inflater = LayoutInflater.from(c);
this.inflater1 = LayoutInflater.from(c);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
View myView = inflater1.inflate(R.layout.cc, null);
/*if (childPosition == 0) {
myView.setBackgroundResource(R.drawable.water);
}
if (childPosition == 1) {
myView.setBackgroundResource(R.drawable.water);
}*/
myView.setBackgroundResource(R.drawable.child);
TextView textview = (TextView) myView
.findViewById(R.id.TextView001);
textview.setText(str2[childPosition]);
return myView;
}
@Override
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
return 5;
}
@Override
public Object getGroup(int groupPosition) {
// TODO Auto-generated method stub
return "dd";
}
@Override
public int getGroupCount() {
// TODO Auto-generated method stub
return 3;
}
@Override
public long getGroupId(int groupPosition) {
// TODO Auto-generated method stub
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,View convertView, ViewGroup parent) {
View myView = inflater.inflate(R.layout.dd, null);
/* if (groupPosition == 0) {
myView.setBackgroundResource(R.drawable.icon);
}
if (groupPosition == 1) {
myView.setBackgroundResource(R.drawable.icon);
}
if (groupPosition == 2) {
myView.setBackgroundResource(R.drawable.icon);
}
*/
myView.setBackgroundResource(R.drawable.group);
TextView textview = (TextView) myView.findViewById(R.id.TextView01);
textview.setText(str1[groupPosition]);
return myView;
}
private Object getResources() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return false;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
带背景图的ExpandableListview界面。。。+ 源码
共31个文件
class:8个
png:7个
xml:5个
5星 · 超过95%的资源 需积分: 16 366 下载量 172 浏览量
2011-03-01
20:44:07
上传
评论 1
收藏 459KB RAR 举报
温馨提示
带背景图的ExpandableListview界面。。。+ 源码。 较为详细地阐述了这个控件的使用。有问题可以用论坛消息和我联系。
资源推荐
资源详情
资源评论
收起资源包目录
ExpandableListView_ByFeatured.rar (31个子文件)
ExpandableListView_ByFeatured
AndroidManifest.xml 716B
res
layout
dd.xml 418B
cc.xml 577B
main.xml 651B
drawable-ldpi
icon.png 2KB
Thumbs.db 4KB
drawable-mdpi
child.png 21KB
child_divider.png 20KB
icon.png 3KB
group_indicator_none.png 20KB
group.png 50KB
drawable-hdpi
icon.png 4KB
Thumbs.db 5KB
values
strings.xml 191B
proguard.cfg 1KB
src
C_ExpandableListView
C_ExpandableListView
C_ExpandableListView.java 3KB
bin
C_ExpandableListView[byCSDN].apk 175KB
classes.dex 5KB
C_ExpandableListView
C_ExpandableListView
R.class 692B
R$layout.class 515B
R$attr.class 409B
C_ExpandableListView.class 1KB
R$id.class 609B
R$string.class 496B
C_ExpandableListView$TreeViewAdapter.class 3KB
R$drawable.class 670B
resources.ap_ 170KB
.classpath 280B
assets
default.properties 362B
.project 864B
gen
C_ExpandableListView
C_ExpandableListView
R.java 1KB
共 31 条
- 1
Featured
- 粉丝: 13
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
前往页