本文整理了Java中android.widget.ExpandableListView.setSelectedGroup()
方法的一些代码示例,展示了ExpandableListView.setSelectedGroup()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListView.setSelectedGroup()
方法的具体详情如下:
包路径:android.widget.ExpandableListView
类名称:ExpandableListView
方法名:setSelectedGroup
暂无
代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox
/**
* Sets the selection to the specified group.
*
* @param groupPosition
* The position of the group that should be selected.
*/
public void setSelectedGroup(int groupPosition) {
mList.setSelectedGroup(groupPosition);
}
代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android
/**
* Sets the selection to the specified group.
*
* @param groupPosition The position of the group that should be selected.
*/
public void setSelectedGroup(int groupPosition) {
mExpandableList.setSelectedGroup(groupPosition);
}
}
代码示例来源:origin: stackoverflow.com
public class ExpandableListAdapter extends BaseExpandableListAdapter{
private Context context;
int group;
ExpandableListView expandableListView;
public ExpandableListAdapter(Context context,ExpandableListView exp,int grp){
this.context = context;
this.expandableListView = exp;
this.group = grp;
}
@Override
public View getGroupView(final int listPosition,final boolean isExpanded,
View convertView,final ViewGroup parent) {
if (convertView == null) {
// your code
}
textview.setText(listTitle); //set view of group before selecting it
if(group != -1){
expandableListView.setSelectedGroup(group);
}
return convertView;
}
}
代码示例来源:origin: stackoverflow.com
expandList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if (!parent.isGroupExpanded(groupPosition)) {
parent.expandGroup(groupPosition);
} else {
parent.collapseGroup(groupPosition);
}
parent.setSelectedGroup(groupPosition);
return true;
}
});
代码示例来源:origin: stackoverflow.com
expandList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if (!parent.isGroupExpanded(groupPosition)) {
parent.expandGroup(groupPosition);
} else {
parent.collapseGroup(groupPosition);
}
parent.setSelectedGroup(groupPosition);
return true;
}
});
代码示例来源:origin: Shuyun123/MenuSummary
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if (sign == -1) {
// 选择展开的项
expandableGridView.expandGroup(groupPosition);
// 将展开的项置于顶端
expandableGridView.setSelectedGroup(groupPosition);
sign = groupPosition;
} else if (sign == groupPosition) {
// 如果已近展开,则将其折叠
expandableGridView.collapseGroup(groupPosition);
sign = -1;
} else {
// 点击其他选项之前,先将之前的关闭掉
expandableGridView.collapseGroup(sign);
expandableGridView.expandGroup(groupPosition);
sign = groupPosition;
}
return true;
}
});
代码示例来源:origin: lucid-lynxz/BlogSamples
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if (expandGroupIndex == -1) {
mEl.expandGroup(groupPosition);
//设置被选中的group置于顶端
//mEl.setSelectedGroup(groupPosition);
expandGroupIndex = groupPosition;
} else if (expandGroupIndex == groupPosition) {
mEl.collapseGroup(expandGroupIndex);
expandGroupIndex = -1;
} else {
mEl.collapseGroup(expandGroupIndex);
//展开被选的group
mEl.expandGroup(groupPosition);
mEl.setSelectedGroup(groupPosition);
expandGroupIndex = groupPosition;
}
mAdapter.setExpandGroupIndex(expandGroupIndex);
long packedPositionForGroup = mEl.getPackedPositionForGroup(groupPosition);
// int packedPositionGroup = mEl.getPackedPositionGroup(packedPositionForGroup);
int flatListPosition = mEl.getFlatListPosition(packedPositionForGroup);
Log.d(TAG, "Group- " + flatListPosition + " - " + packedPositionForGroup);
return true;
}
}
代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android
if (otpBundle.isFromInfoWindow()) {
elv.expandGroup(otpBundle.getCurrentStepIndex());
elv.setSelectedGroup(otpBundle.getCurrentStepIndex());
otpBundle.setFromInfoWindow(false);
代码示例来源:origin: stackoverflow.com
mExpandableListView.setSelectedGroup(arg0);
内容来源于网络,如有侵权,请联系作者删除!