社区
Android
帖子详情
类似于ExpandableListActivity的三级联动,怎么做呢,有没有什么好的建议
dontsaymiss
2011-12-08 11:46:28
我们知道,ExpandableListActivity最后的效果是:
Group1
childData1
childData2
。。。。。。
Group2
。。。。。。
我现在想要做的效果是这样:
Group1
SubGroup1
childData1
childData2
。。。。。。
SubGroup2
。。。。。。
Group2
。。。。。。
我应该怎么做呢
...全文
36
3
打赏
收藏
类似于ExpandableListActivity的三级联动,怎么做呢,有没有什么好的建议
我们知道,ExpandableListActivity最后的效果是: Group1 childData1 childData2 。。。。。。 Group2 。。。。。。 我现在想要做的效果是这样: Group1 SubGroup1 childData1 childData2 。。。。。。 SubGroup2 。。。。。。 Group2 。。。。。。 我应该怎么做呢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dontsaymiss
2011-12-08
打赏
举报
回复
自己找到答案了
http://blog.csdn.net/hellogv/article/details/6120133
每次都是百度不出来->发帖->自己百度出来了。。。
Expand
able
List
Activity
NULL 博文链接:https://wang-peng1.iteye.com/blog/683156
Expand
able
List
Activity
例子,自动展开
Expand
able
List
Activity
的基本例子,打开后每隔一秒展开一个item
Expand
able
List
Activity
和Simple
Expand
able
List
Adapter的基本使用详解
Expand
able
List
Activity
和Simple
Expand
able
List
Adapter的基本使用详解
Preference
Activity
和
Expand
able
List
Activity
的使用
Preference
Activity
和
Expand
able
List
Activity
的使用,详细了解请移步:http://blog.csdn.net/zxc514257857/article/details/77773001
android 的
类似
于QQ分组的二级列表
package wjq.WidgetDemo; import android.app.
Expand
able
List
Activity
; import android.os.Bundle; import android.provider.Contacts.People; import android.util.Log; import android.view.ContextMenu; import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ContextMenu.ContextMenuInfo; import android.widget.Abs
List
View; import android.widget.Base
Expand
able
List
Adapter; import android.widget.
Expand
able
List
Adapter; import android.widget.
Expand
able
List
View; import android.widget.TextView; import android.widget.Toast; import android.widget.
Expand
able
List
View.
Expand
able
List
ContextMenuInfo; public class
Expand
able
List
Demo extends
Expand
able
List
Activity
{ private
Expand
able
List
Adapter adapter; //private My
Expand
able
List
Adapter MyAdapter=new My
Expand
able
List
Adapter(); /* (non-Javadoc) * @see android.app.
Activity
#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); adapter=new My
Expand
able
List
Adapter(); set
List
Adapter(adapter); registerForContextMenu(get
Expand
able
List
View()); } /* (non-Javadoc) * @see android.app.
Expand
able
List
Activity
#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo) */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderTitle("菜单"); menu.add(0, 0, 0, "Action"); } /* (non-Javadoc) * @see android.app.
Activity
#onContextItemSelected(android.view.MenuItem) */ @Override public boolean onContextItemSelected(MenuItem item) { boolean flag=false; // TODO Auto-generated method stub
Expand
able
List
ContextMenuInfo menuInfo=(
Expand
able
List
ContextMenuInfo)item.getMenuInfo(); String title=((TextView)menuInfo.targetView).getText().toString(); int type=
Expand
able
List
View.getPackedPositionType(menuInfo.packedPosition); if (type==
Expand
able
List
View.PACKED_POSITION_TYPE_CHILD) { int groupPos =
Expand
able
List
View.getPackedPositionGroup(menuInfo.packedPosition); int childPos =
Expand
able
List
View.getPackedPositionChild(menuInfo.packedPosition); CharSequence str="您单击了"+title; Toast.makeText(this, str, Toast.LENGTH_SHORT).show(); Log.i("tag", "Run Hereing..."); flag= true; } else if (type ==
Expand
able
List
View.PACKED_POSITION_TYPE_GROUP) { int groupPos =
Expand
able
List
View.getPackedPositionGroup(menuInfo.packedPosition); CharSequence cs="您单击了"+title; Toast.makeText(this, cs, Toast.LENGTH_SHORT).show(); Log.i("tag", "Run Here..."); flag= true; } return flag; } public class My
Expand
able
List
Adapter extends Base
Expand
able
List
Adapter { // Sample data set. children[i] contains the children (String[]) for groups[i]. public String[] groups = { "我的好友", "新疆同学", "亲戚", "同事" }; public String[][] children = { { "胡算林", "张俊峰", "王志军", "二人" }, { "李秀婷", "蔡乔", "别高", "余音" }, { "摊派新", "张爱明" }, { "马超", "司道光" } }; public Object getChild(int groupPosition, int childPosition) { return children[groupPosition][childPosition]; } public long getChildId(int groupPosition, int childPosition) { return childPosition; } public int getChildrenCount(int groupPosition) { return children[groupPosition].length; } public TextView getGenericView() { // Layout parameters for the
Expand
able
List
View Abs
List
View.LayoutParams lp = new Abs
List
View.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, 64); TextView textView = new TextView(
Expand
able
List
Demo.this); textView.setLayoutParams(lp); // Center the text vertically textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); // Set the text starting position textView.setPadding(36, 0, 0, 0); return textView; } public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getChild(groupPosition, childPosition).toString()); return textView; } public Object getGroup(int groupPosition) { return groups[groupPosition]; } public int getGroupCount() { return groups.length; } public long getGroupId(int groupPosition) { return groupPosition; } public View getGroupView(int groupPosition, boolean is
Expand
ed, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getGroup(groupPosition).toString()); return textView; } public boolean isChildSelect
able
(int groupPosition, int childPosition) { return true; } public boolean hasSt
able
Ids() { return true; } } }
Android
80,351
社区成员
91,288
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章