社区
Android
帖子详情
紧急求助——ExpandableListActivity
3052world
2012-11-08 08:50:23
Android中ExpandableListActivity怎样与单选框结合?类似下图所示
请大侠给出具体步骤,有实例代码就更好了,多谢!
...全文
116
2
打赏
收藏
紧急求助——ExpandableListActivity
Android中ExpandableListActivity怎样与单选框结合?类似下图所示 请大侠给出具体步骤,有实例代码就更好了,多谢!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Imgnation
2012-11-08
打赏
举报
回复
下面的子项用单独的布局,布局里面写单选, 可以用一个标记,点了那一项就显示,其他的不显示, 愚见
森_哥
2012-11-08
打赏
举报
回复
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,471
社区成员
91,384
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章