下面列出了android.widget.ExpandableListView#setGroupIndicator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 初始化所有城市列表
*/
public void initAllCityList() {
// 扩展列表
View provinceContainer = LayoutInflater.from(OfflineMapActivity_Old.this)
.inflate(R.layout.offline_province_listview, null);
mAllOfflineMapList = (ExpandableListView) provinceContainer
.findViewById(R.id.province_download_list);
initProvinceListAndCityMap();
// adapter = new OfflineListAdapter(provinceList, cityMap, amapManager,
// OfflineMapActivity_Old.this);
adapter = new OfflineListAdapter(provinceList, amapManager,
OfflineMapActivity_Old.this);
// 为列表绑定数据源
mAllOfflineMapList.setAdapter(adapter);
// adapter实现了扩展列表的展开与合并监听
mAllOfflineMapList.setOnGroupCollapseListener(adapter);
mAllOfflineMapList.setOnGroupExpandListener(adapter);
mAllOfflineMapList.setGroupIndicator(null);
}
/**
* 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();
}
/**
* 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();
}
@Override
public void onViewCreated(android.view.View view, android.os.Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle args = getArguments();
if (args != null) {
String title = "" + args.getCharSequence(Constants.KEY_TITLE);
}
listView = (ExpandableListView) view.findViewById(R.id.expandableListView);
listView.setGroupIndicator(null);
final TextView textView = (TextView) view.findViewById(R.id.textViewSave);
textView.setClickable(true);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((ActPlaylist) activity).save();
}
});
}
/**
* {@inheritDoc}
*
* @see org.emdev.ui.AbstractActionActivity#onCreateImpl(android.os.Bundle)
*/
@Override
protected void onCreateImpl(final Bundle savedInstanceState) {
setContentView(R.layout.opds);
setActionForView(R.id.opdsaddfeed);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final OPDSActivityController c = getController();
list = (ExpandableListView) findViewById(R.id.opdslist);
list.setGroupIndicator(null);
list.setChildIndicator(null);
list.setOnGroupClickListener(c);
list.setOnChildClickListener(c);
list.setAdapter(c.adapter);
this.registerForContextMenu(list);
}
public void setList(ExpandableListView listView, ArrayList<AlbumInfo> list) {
if (list != null && listView != null) {
this.mList.clear();
this.mList.addAll(list);
notifyDataSetChanged();
for (int i = 0; i < getGroupCount(); i++) {
listView.expandGroup(i);
}
listView.setGroupIndicator(null);
}
}
public void setList(ExpandableListView listView, List<LTStarRankModelDetailPB> list) {
if (list != null && listView != null) {
this.mList.clear();
this.mList.addAll(list);
notifyDataSetChanged();
for (int i = 0; i < getGroupCount(); i++) {
listView.expandGroup(i);
}
listView.setGroupIndicator(null);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mLayoutInflater = inflater;
ExpandableListView listView = new ExpandableListView(getActivity());
listView.setGroupIndicator(null);
if (mPackageInfo == null) {
Toast.makeText(getActivity(), R.string.app_not_installed, Toast.LENGTH_LONG).show();
} else {
listView.setAdapter(new Adapter());
}
return listView;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mInflater = inflater;
View v = inflater.inflate(R.layout.fragment_api_test, container, false);
mProgressDialog = new ProgressDialog(getActivity());
mProgressDialog.setMessage("Sending request...");
mExpandableListView = (ExpandableListView) v.findViewById(R.id.expandable_list_view);
mExpandableListView.setGroupIndicator(null);
initData();
mExpandableListView.setOnChildClickListener(this);
return v;
}
/**
* 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(ChromeActivity 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 = new RecentTabsRowAdapter(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.
if (activity.getBottomSheet() != null) {
View recentTabsRoot = mView.findViewById(R.id.recent_tabs_root);
ApiCompatibilityUtils.setPaddingRelative(recentTabsRoot,
ApiCompatibilityUtils.getPaddingStart(recentTabsRoot), 0,
ApiCompatibilityUtils.getPaddingEnd(recentTabsRoot),
activity.getResources().getDimensionPixelSize(
R.dimen.bottom_control_container_height));
}
onUpdated();
}
private void initView() {
m_QQClient = AppData.getAppData().getQQClient();
m_buddyList = m_QQClient.getBuddyList();
// m_btnBuddyTeam = (Button)getActivity().findViewById(R.id.contacts_btnBuddyTeam);
// m_btnAllBuddy = (Button)getActivity().findViewById(R.id.contacts_btnAllBuddy);
mListView = (ExpandableListView)getActivity().findViewById(R.id.expandableListView);
// m_btnGroup = (ImageButton)getActivity().findViewById(R.id.contacts_btnGroup);
swipeRefreshLayout_freind= (PullRefreshLayout) getActivity().findViewById(R.id.swipeRefreshLayout_friend);
// m_btnBuddyTeam.setOnClickListener(this);
// m_btnAllBuddy.setOnClickListener(this);
// m_btnGroup.setOnClickListener(this);
//ExpandableListView actualListView = mListView.getRefreshableView();
mListView.setGroupIndicator(null);
m_blistAdapter = new BuddyListAdapter(getActivity(), m_buddyList);
mListView.setAdapter(m_blistAdapter);
mListView.setDescendantFocusability(
ExpandableListView.FOCUS_AFTER_DESCENDANTS);
mListView.setOnChildClickListener(this);
// mListView.getLoadingLayoutProxy().setPullLabel("下拉刷新");
// mListView.getLoadingLayoutProxy().setReleaseLabel("释放立即刷新");
// mListView.getLoadingLayoutProxy().setRefreshingLabel("正在刷新...");
// mListView.getLoadingLayoutProxy().setLastUpdatedLabel("");
swipeRefreshLayout_freind.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new GetDataTask().execute();
swipeRefreshLayout_freind.postDelayed(new Runnable() {
@Override
public void run() {
swipeRefreshLayout_freind.setRefreshing(false);
refresh();
// m_glistAdapter.notifyDataSetChanged();
}
}, 1000);
}
});
}
private PopupWindow getPopup() {
if (mPopup == null) {
ViewGroup layout = (ViewGroup) mInflater.inflate(
R.layout.datasource_list_window, null);
mListView = (ExpandableListView) layout
.findViewById(R.id.expandableListView);
Button moreButton = (Button) layout
.findViewById(R.id.buttonMore);
DataSourceListAdapter sourceListAdapter = new DataSourceListAdapter(
GeoARActivity.this, mListView, visualizationClass);
mListView.setAdapter(sourceListAdapter);
IntroController.addViewToStep(9, mListView.getChildAt(mListView.getFirstVisiblePosition()));
mListView.setGroupIndicator(null);
// Click event for "More" button
moreButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
showFragment(mPluginFragment);
mPopup.dismiss();
}
});
mPopup = new ActionProviderPopupWindow(layout);
mPopup.setTouchable(true);
mPopup.setOutsideTouchable(true);
TypedArray typedArray = obtainStyledAttributes(new int[] { R.attr.actionDropDownStyle });
int resId = typedArray.getResourceId(0, 0);
typedArray = obtainStyledAttributes(resId,
new int[] { android.R.attr.popupBackground });
mPopup.setBackgroundDrawable(new BitmapDrawable(getResources()));
layout.setBackgroundResource(typedArray.getResourceId(0, 0));
// mPopup.setBackgroundDrawable(typedArray.getDrawable(0));
mPopup.setWindowLayoutMode(0, LayoutParams.WRAP_CONTENT);
// Set width of menu
mPopup.setWidth((int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 250, getResources()
.getDisplayMetrics()));
}
return mPopup;
}