本文整理了Java中android.widget.ExpandableListView.setOnGroupExpandListener()
方法的一些代码示例,展示了ExpandableListView.setOnGroupExpandListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListView.setOnGroupExpandListener()
方法的具体详情如下:
包路径:android.widget.ExpandableListView
类名称:ExpandableListView
方法名:setOnGroupExpandListener
暂无
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
InputStream raw=getResources().openRawResource(R.raw.sample);
BufferedReader in=new BufferedReader(new InputStreamReader(raw));
String str;
StringBuffer buf=new StringBuffer();
try {
while ((str=in.readLine()) != null) {
buf.append(str);
buf.append('\n');
}
in.close();
JSONObject model=new JSONObject(buf.toString());
ExpandableListView elv=(ExpandableListView)findViewById(R.id.elv);
adapter=new JSONExpandableListAdapter(getLayoutInflater(), model);
elv.setAdapter(adapter);
elv.setOnChildClickListener(this);
elv.setOnGroupClickListener(this);
elv.setOnGroupExpandListener(this);
elv.setOnGroupCollapseListener(this);
}
catch (Exception e) {
Log.e(getClass().getName(), "Exception reading JSON", e);
}
}
代码示例来源:origin: stackoverflow.com
epView.setOnGroupExpandListener(new OnGroupExpandListener() {
代码示例来源:origin: jclehner/rxdroid
public void setOnGroupCollapseExpandListener(OnGroupCollapseExpandListener l)
{
mGroupCollapseExpandListener = l;
if(mList != null)
{
mList.setOnGroupCollapseListener(l);
mList.setOnGroupExpandListener(l);
}
}
代码示例来源:origin: openMF/mobile-wallet
/**
* Method to initialize the listeners
*/
public void initListeners() {
// ExpandableListView Group expanded listener
expandableListView.setOnGroupExpandListener(
new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
Toast.makeText(getApplicationContext(),
listDataGroup.get(groupPosition) + "Collapsed",
Toast.LENGTH_SHORT).show();
}
});
// ExpandableListView Group collapsed listener
expandableListView.setOnGroupCollapseListener(
new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
Toast.makeText(getApplicationContext(),
listDataGroup.get(groupPosition) + "Collapsed",
Toast.LENGTH_SHORT).show();
}
});
}
代码示例来源:origin: stackoverflow.com
listView.setOnGroupExpandListener(new OnGroupExpandListener() {
代码示例来源:origin: stackoverflow.com
expandableListAdapter = new CustomExpandableListAdapter(getActivity(), expandableListTitle, expandableListDetail);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
代码示例来源:origin: stackoverflow.com
expListView.setOnGroupExpandListener(new OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
代码示例来源:origin: jclehner/rxdroid
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.layout_expandable_list, null);
mList = (ExpandableListView) v.findViewById(android.R.id.list);
mEmptyView = (TextView) v.findViewById(android.R.id.empty);
mList.setAdapter(mAdapter);
mList.setOnGroupCollapseListener(mGroupCollapseExpandListener);
mList.setOnGroupExpandListener(mGroupCollapseExpandListener);
mList.setOnGroupClickListener(this);
mList.setOnChildClickListener(this);
if(mExpandAll)
expandAllInternal();
mList.setEmptyView(mEmptyView);
mEmptyView.setText(mEmptyViewTextResId);
return v;
}
代码示例来源:origin: stackoverflow.com
expandableListAdapter = new CustomExpandableListAdapter(this, expandableListTitle, expandableListDetail);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
代码示例来源:origin: DingMouRen/DingDingMap
/**
* 初始化所有城市列表
*/
public void initAllCityList() {
// 扩展列表
View provinceContainer = LayoutInflater.from(OfflineMapActivity.this)
.inflate(R.layout.offline_province_listview, null);
mAllOfflineMapList = (ExpandableListView) provinceContainer
.findViewById(R.id.province_download_list);
initProvinceListAndCityMap();
adapter = new OfflineListAdapter(provinceList, amapManager,
OfflineMapActivity.this);
// 为列表绑定数据源
mAllOfflineMapList.setAdapter(adapter);
// adapter实现了扩展列表的展开与合并监听
mAllOfflineMapList.setOnGroupCollapseListener(adapter);
mAllOfflineMapList.setOnGroupExpandListener(adapter);
mAllOfflineMapList.setGroupIndicator(null);
}
代码示例来源:origin: stackoverflow.com
expandableListAdapter = new CustomExpandableListAdapter(inflate., expandableListTitle, expandableListDetail);
expandableListView.setAdapter(expandableListAdapter);
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android
/**
* Updates the screen state (current list and other views) when the
* content changes.
*
* @see Activity.onContentChanged()
*/
public void onContentChanged() {
// super.onContentChanged();
View emptyView = getView().findViewById(android.R.id.empty);
mExpandableList = (ExpandableListView) getView().findViewById(android.R.id.list);
if (mExpandableList == null) {
throw new RuntimeException(
"Your content must have a ExpandableListView whose id attribute is " +
"'android.R.id.list'");
}
if (emptyView != null) {
mExpandableList.setEmptyView(emptyView);
}
mExpandableList.setOnChildClickListener(this);
mExpandableList.setOnGroupExpandListener(this);
mExpandableList.setOnGroupCollapseListener(this);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mFinishedStart = true;
}
代码示例来源:origin: sivailango/ExpandableListView-RecylerChildItems
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBrandsListView = (ExpandableListView) findViewById(R.id.list_brands);
data();
mBrandAdapter = new BrandAdapter(this, brands);
mBrandsListView.setAdapter(mBrandAdapter);
mBrandsListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
int previousGroup = -1;
@Override
public void onGroupExpand(int groupPosition) {
if ((previousGroup != -1) && (groupPosition != previousGroup)) {
mBrandsListView.collapseGroup(previousGroup);
}
previousGroup = groupPosition;
}
});
}
代码示例来源:origin: derry/delion
/**
* Constructor returns an instance of RecentTabsPage.
*
* @param activity The activity this view belongs to.
* @param recentTabsManager The RecentTabsManager which provides the model data.
*/
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
mActivity = activity;
mRecentTabsManager = recentTabsManager;
mTitle = activity.getResources().getString(R.string.recent_tabs);
mThemeColor = ApiCompatibilityUtils.getColor(
activity.getResources(), R.color.default_primary_color);
mRecentTabsManager.setUpdatedCallback(this);
LayoutInflater inflater = LayoutInflater.from(activity);
mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
mAdapter = buildAdapter(activity, recentTabsManager);
mListView.setAdapter(mAdapter);
mListView.setOnChildClickListener(this);
mListView.setGroupIndicator(null);
mListView.setOnGroupCollapseListener(this);
mListView.setOnGroupExpandListener(this);
mListView.setOnCreateContextMenuListener(this);
mView.addOnAttachStateChangeListener(this);
ApplicationStatus.registerStateListenerForActivity(this, activity);
// {@link #mInForeground} will be updated once the view is attached to the window.
onUpdated();
}
代码示例来源:origin: stackoverflow.com
mExpandalbeView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
代码示例来源:origin: stackoverflow.com
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox
/**
* Updates the screen state (current list and other views) when the content changes.
*
* @see android.support.v7.app.AppCompatActivity#onContentChanged()
*/
@Override
public void onContentChanged() {
super.onContentChanged();
View emptyView = findViewById(R.id.empty);
mList = findViewById(R.id.list);
if (mList == null) {
throw new RuntimeException(
"Your content must have a ExpandableListView whose id attribute is " +
"'R.id.list'");
}
if (emptyView != null) {
mList.setEmptyView(emptyView);
}
mList.setOnChildClickListener(this);
mList.setOnGroupExpandListener(this);
mList.setOnGroupCollapseListener(this);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mFinishedStart = true;
}
代码示例来源:origin: gigabytedevelopers/FireFiles
@Override
public void onLoadFinished(
Loader<Collection<RootInfo>> loader, Collection<RootInfo> result) {
if (!isAdded()) return;
final Intent includeApps = getArguments().getParcelable(EXTRA_INCLUDE_APPS);
if (mAdapter == null) {
mAdapter = new RootsExpandableAdapter(context, result, includeApps);
Parcelable state = mList.onSaveInstanceState();
mList.setAdapter(mAdapter);
mList.onRestoreInstanceState(state);
} else {
mAdapter.setData(result);
}
int groupCount = mAdapter.getGroupCount();
if(group_size != 0 && group_size == groupCount){
if (expandedIds != null) {
restoreExpandedState(expandedIds);
}
} else {
group_size = groupCount;
for (int i = 0; i < group_size; i++) {
mList.expandGroup(i);
}
expandedIds = getExpandedIds();
mList.setOnGroupExpandListener(mOnGroupExpandListener);
mList.setOnGroupCollapseListener(mOnGroupCollapseListener);
}
}
代码示例来源:origin: stackoverflow.com
expList.setOnGroupExpandListener(new OnGroupExpandListener()
代码示例来源:origin: stackoverflow.com
exList.setOnGroupExpandListener(this);
内容来源于网络,如有侵权,请联系作者删除!