本文整理了Java中android.widget.ExpandableListView.getFlatListPosition()
方法的一些代码示例,展示了ExpandableListView.getFlatListPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListView.getFlatListPosition()
方法的具体详情如下:
包路径:android.widget.ExpandableListView
类名称:ExpandableListView
方法名:getFlatListPosition
暂无
代码示例来源:origin: stackoverflow.com
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
...
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
parent.setItemChecked(index, true);
return true;
}
代码示例来源:origin: stackoverflow.com
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
...
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
parent.setItemChecked(index, true);
return true;
}
代码示例来源:origin: stackoverflow.com
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) {
int index = expandableListView.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
if(isActionModeEnabled){
expListView.setItemChecked(index,true);
}
return true;
}
});
代码示例来源:origin: lucid-lynxz/BlogSamples
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
long packedPositionForChild = mEl.getPackedPositionForChild(groupPosition, childPosition);
// int packedPositionChild = mEl.getPackedPositionChild(packedPositionForChild);
int flatListPosition = mEl.getFlatListPosition(packedPositionForChild);
Log.d(TAG, "Child- " + flatListPosition + " - " + packedPositionForChild);
Toast.makeText(BasicExpandableListView.this, "group=" + groupPosition + "-child=" + childPosition, Toast.LENGTH_SHORT).show();
return false;
}
}
代码示例来源:origin: stackoverflow.com
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
...
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
parent.setItemChecked(index, true);
return true;
}
代码示例来源:origin: stackoverflow.com
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
parent.setItemChecked(index, true);
代码示例来源:origin: stackoverflow.com
public View getGroupView(ExpandableListView listView, int groupPosition) {
long packedPosition = ExpandableListView.getPackedPositionForGroup(groupPosition);
int flatPosition = listView.getFlatListPosition(groupPosition);
int first = listView.getFirstVisbileView();
return listView.getChildAt(flatPosition - first);
}
代码示例来源:origin: stackoverflow.com
final int position = listView.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
listView.setItemChecked(position, checkedState[groupPosition][childPosition]);
代码示例来源:origin: gigabytedevelopers/FireFiles
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
final BaseActivity activity = BaseActivity.get(RootsFragment.this);
final Item item = (Item) mAdapter.getChild(groupPosition, childPosition);
if (item instanceof RootItem) {
int index = parent.getFlatListPosition(ExpandableListView.getPackedPositionForChild(groupPosition, childPosition));
parent.setItemChecked(index, true);
activity.onRootPicked(((RootItem) item).root, true);
Bundle params = new Bundle();
params.putString("type", ((RootItem) item).root.title);
AnalyticsManager.logEvent("navigate", ((RootItem) item).root, params);
} else if (item instanceof AppItem) {
activity.onAppPicked(((AppItem) item).info);
} else {
throw new IllegalStateException("Unknown root: " + item);
}
return false;
}
};
代码示例来源: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: gigabytedevelopers/FireFiles
public void onCurrentRootChanged() {
if (mAdapter == null || mList == null) return;
final RootInfo root = ((BaseActivity) getActivity()).getCurrentRoot();
for (int i = 0; i < mAdapter.getGroupCount(); i++) {
for (int j = 0; j < mAdapter.getChildrenCount(i); j++) {
final Object item = mAdapter.getChild(i,j);
if (item instanceof RootItem) {
final RootInfo testRoot = ((RootItem) item).root;
if (Objects.equal(testRoot, root)) {
try {
long id = ExpandableListView.getPackedPositionForChild(i, j);
int index = mList.getFlatListPosition(id);
//mList.setSelection(index);
mList.setItemChecked(index, true);
} catch (Exception e){
CrashReportingManager.logException(e);
}
return;
}
}
}
}
}
代码示例来源:origin: stackoverflow.com
flatPosition = _expandableListView.getFlatListPosition(position);
final int flatPosition;
flatPosition = _expandableListView.getFlatListPosition(getCheckedPosition());
_expandableListView.setItemChecked(flatPosition , false);
内容来源于网络,如有侵权,请联系作者删除!