ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv_main); elv.setAdapter(adapter); for(int i=0; i < adapter.getGroupCount(); i++) elv.expandGroup(i);
/** * Set the adapter of an ExpandableListView. * * @param adapter adapter * @return self */ public T adapter(ExpandableListAdapter adapter){ if(view instanceof ExpandableListView){ ExpandableListView av = (ExpandableListView) view; av.setAdapter(adapter); } return self(); }
@Override public void configViews() { showDialog(); elvMale.setAdapter(maleAdapter); elvFeMale.setAdapter(femaleAdapter); mPresenter.attachView(this); mPresenter.getRankList(); }
@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); } }
elv.setAdapter(adapter);
expandableList.setAdapter(mMenuAdapter);
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_dialog_home); ButterKnife.bind(this); mMenuItems.add(new DialogMenuItem("收藏", R.mipmap.ic_winstyle_favor)); mMenuItems.add(new DialogMenuItem("下载", R.mipmap.ic_winstyle_download)); mMenuItems.add(new DialogMenuItem("分享", R.mipmap.ic_winstyle_share)); mMenuItems.add(new DialogMenuItem("删除", R.mipmap.ic_winstyle_delete)); mMenuItems.add(new DialogMenuItem("歌手", R.mipmap.ic_winstyle_artist)); mMenuItems.add(new DialogMenuItem("专辑", R.mipmap.ic_winstyle_album)); mBasIn = new BounceTopEnter(); mBasOut = new SlideBottomExit(); View decorView = getWindow().getDecorView(); HomeAdapter adapter = new HomeAdapter(mContext); mElv.setAdapter(adapter); // extend all group for (int i = 0; i < mGroups.length; i++) { mElv.expandGroup(i); } mElv.setOnChildClickListener(this); mElv.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { return true; } }); }
mSpoofSession = new SpoofSession(false, false, null, null); mListView.setAdapter(mAdapter);
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_main); // Init top level data List<String> listDataHeader = new ArrayList<>(); String[] mItemHeaders = getResources().getStringArray(R.array.items_array_expandable_level_one); Collections.addAll(listDataHeader, mItemHeaders); ExpandableListView mExpandableListView = (ExpandableListView) findViewById(R.id.expandableListView_Parent); if (mExpandableListView != null) { ParentLevelAdapter parentLevelAdapter = new ParentLevelAdapter(this, listDataHeader); mExpandableListView.setAdapter(parentLevelAdapter); } } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ExpandableListView listView; listView = (ExpandableListView) view.findViewById(R.id.expListView); listView.setAdapter(new ExpandableListAdapter(questions, answers)); listView.setGroupIndicator(null); }
private void loadListView(View view) { List<String> mListDataHeader = new ArrayList<String>(); mListDataHeader.add(context.getString(R.string.fragment_config_choose)); HashMap<String, List<ExpandableListItem>> mListDataChild = new HashMap<String, List<ExpandableListItem>>(); ArrayList<ExpandableListItem> mApps = getInstalledApps(); Collections.sort(mApps, new Comparator<ExpandableListItem>() { public int compare(ExpandableListItem o1, ExpandableListItem o2) { return o1.getAppName().compareTo(o2.getAppName()); } }); ExpandableListView appList = (ExpandableListView) view.findViewById(R.id.appsListView); mListDataChild.put(mListDataHeader.get(0), mApps); appList.setAdapter(new ExpandableListAdapter(getActivity(), mListDataHeader, mListDataChild)); }
expandableList.setAdapter(mMenuAdapter);
childActions.put(6, new ArrayList<String>()); mDrawerListView.setAdapter(new ExpandableAdapter(getActivity(), mainActions, childActions)); mDrawerListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override
elv.setAdapter(adapter);
lv.setAdapter(new ExpandableListAdapter(groups, children)); lv.setGroupIndicator(null);
private void clearUI() { mExportString = null; mGattServicesList.setAdapter((SimpleExpandableListAdapter) null); mGattUUID.setText(R.string.no_data); mGattUUIDDesc.setText(R.string.no_data); mDataAsArray.setText(R.string.no_data); mDataAsString.setText(R.string.no_data); }
public class Listview extends Activity { ExpandableListView exv; protected void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listview); }; public Listview() { // TODO Auto-generated constructor stub exv=(ExpandableListView)findViewById(R.id.expandableListView1); exv.setAdapter(new MyAdapter(this)); }
@Override public void destroy() { assert getView().getParent() == null : "Destroy called before removed from window"; mRecentTabsManager.destroy(); mRecentTabsManager = null; mAdapter.notifyDataSetInvalidated(); mAdapter = null; mListView.setAdapter((RecentTabsRowAdapter) null); mView.removeOnAttachStateChangeListener(this); ApplicationStatus.unregisterActivityStateListener(this); }
private void initEvents() { selva = new ShopcartAdapter(groups, children, this); selva.setCheckInterface(this);// 关键步骤1,设置复选框接口 selva.setModifyCountInterface(this);// 关键步骤2,设置数量增减接口 selva.setmListener(this); exListView.setAdapter(selva); for (int i = 0; i < selva.getGroupCount(); i++) { exListView.expandGroup(i);// 关键步骤3,初始化时,将ExpandableListView以展开的方式呈现 } }
public KeyBindingsDialog(final IActivityController base) { super(base.getContext()); setTitle("Keys binding"); actionsAdapter = new ActionsAdapter(getContext()); final ExpandableListView list = new ExpandableListView(getContext()); final KeyGroups groups = initKeyActions(); list.setAdapter(groups); LayoutUtils.fillInParent(null, list); setContentView(list); }