本文整理汇总了Java中android.widget.SimpleExpandableListAdapter类的典型用法代码示例。如果您正苦于以下问题:Java SimpleExpandableListAdapter类的具体用法?Java SimpleExpandableListAdapter怎么用?Java SimpleExpandableListAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleExpandableListAdapter类属于android.widget包,在下文中一共展示了SimpleExpandableListAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateGattServicesAdapter
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
/**
* Update GATT service adapter.
*
* @param gattServiceData is services list.
* @param gattCharacteristicData is characteristics list.
* @return GATT service adapter.
* @see kr.co.sevencore.blefotalib.BflFwUploadService
*/
public SimpleExpandableListAdapter updateGattServicesAdapter(
ArrayList<HashMap<String, String>> gattServiceData, ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData) {
SimpleExpandableListAdapter gattServiceAdapter = new SimpleExpandableListAdapter(
mContext,
gattServiceData,
android.R.layout.simple_expandable_list_item_2,
new String[] {BflCodeList.LIST_NAME, BflCodeList.LIST_UUID},
new int[] { android.R.id.text1, android.R.id.text2},
gattCharacteristicData,
android.R.layout.simple_expandable_list_item_2,
new String[] {BflCodeList.LIST_NAME, BflCodeList.LIST_UUID},
new int[] { android.R.id.text1, android.R.id.text2 }
);
return gattServiceAdapter;
}
示例2: doInBackground
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... arg0) {
expListAdapter =
new SimpleExpandableListAdapter(
TransactionsActivity.this,
createGroupList(), // Creating group List.
R.layout.group_row, // Group item layout XML.
new String[] { "Month" }, // the key of group item.
new int[] { R.id.row_name }, // ID of each group item.-Data under the key goes into this TextView.
createChildList(), // childData describes second-level entries.
R.layout.child_row, // Layout for sub-level entries(second level).
new String[] {"Transaction"}, // Keys in childData maps to display.
new int[] { R.id.grp_child} // Data under the keys above go into these TextViews.
);
return null;
}
示例3: doInBackground
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... arg0) {
expListAdapter =
new SimpleExpandableListAdapter(
TransactionsShortActivity.this,
createGroupList(), // Creating group List.
R.layout.group_row, // Group item layout XML.
new String[] { "Month" }, // the key of group item.
new int[] { R.id.row_name }, // ID of each group item.-Data under the key goes into this TextView.
createChildList(), // childData describes second-level entries.
R.layout.child_row, // Layout for sub-level entries(second level).
new String[] {"Transaction"}, // Keys in childData maps to display.
new int[] { R.id.grp_child} // Data under the keys above go into these TextViews.
);
return null;
}
示例4: clearUI
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
protected void clearUI() {
mDeviceAddress.setText(String.format(getString(R.string.ble_address), ""));
mDeviceStatus.setText(String.format(getString(R.string.ble_state), ""));
mDeviceData.setText(String.format(getString(R.string.ble_data), ""));
mDeviceService.setAdapter((SimpleExpandableListAdapter)null);
}
示例5: clearUI
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
private void clearUI() {
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);
}
示例6: onCreate
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ptr_expandable_list);
mPullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);
// Set a listener to be invoked when the list should be refreshed.
mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ExpandableListView>() {
@Override
public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
for (String group : mGroupStrings) {
Map<String, String> groupMap1 = new HashMap<String, String>();
groupData.add(groupMap1);
groupMap1.put(KEY, group);
List<Map<String, String>> childList = new ArrayList<Map<String, String>>();
for (String string : mChildStrings) {
Map<String, String> childMap = new HashMap<String, String>();
childList.add(childMap);
childMap.put(KEY, string);
}
childData.add(childList);
}
mAdapter = new SimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1,
new String[] { KEY }, new int[] { android.R.id.text1 }, childData,
android.R.layout.simple_expandable_list_item_2, new String[] { KEY }, new int[] { android.R.id.text1 });
setListAdapter(mAdapter);
}
示例7: ExpandableListLayout
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
public ExpandableListLayout(Context c) {
super(c);
expanded = new boolean[GROUP.length];
List<Map<String, String>> groupData = new ArrayList<>();
List<List<Map<String, String>>> childData = new ArrayList<>();
for (int i = 0; i < GROUP.length; i++) {
Map<String, String> map = new HashMap<String, String>();
groupData.add(map);
map.put(NAME, GROUP[i]);
List<Map<String, String>> children = new ArrayList<>();
for (int j = 0; j < CHILD[i].length; j++) {
Map<String, String> childMap = new HashMap<String, String>();
children.add(childMap);
childMap.put(NAME, CHILD[i][j]);
}
childData.add(children);
expanded[i] = false;
}
mAdapter = new SimpleExpandableListAdapter(c, groupData,
android.R.layout.simple_expandable_list_item_1,
new String[] { NAME }, new int[] { android.R.id.text1 },
childData, android.R.layout.simple_expandable_list_item_2,
new String[] { NAME }, new int[] { android.R.id.text1 });
}
示例8: onCreate
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
for (int i = 0; i < 20; i++) {
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME, "Group " + i);
curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd");
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 0; j < 15; j++) {
Map<String, String> curChildMap = new HashMap<String, String>();
children.add(curChildMap);
curChildMap.put(NAME, "Child " + j);
curChildMap.put(IS_EVEN, (j % 2 == 0) ? "This child is even" : "This child is odd");
}
childData.add(children);
}
// Set up our adapter
mAdapter = new SimpleExpandableListAdapter(
this,
groupData,
android.R.layout.simple_expandable_list_item_1,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 },
childData,
android.R.layout.simple_expandable_list_item_2,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 }
);
setListAdapter(mAdapter);
}
示例9: testPerformItemClick_ShouldFireOnItemClickListener
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Ignore("not yet working in 2.0, sorry :-(") // todo 2.0-cleanup
@Test
public void testPerformItemClick_ShouldFireOnItemClickListener() throws Exception {
SimpleExpandableListAdapter adapter = holyCrapYouHaveGotToBeKidding();
expandableListView.setAdapter(adapter);
expandableListView.setOnChildClickListener(myOnChildClickListener);
expandableListView.expandGroup(1);
shadowOf(expandableListView).populateItems();
expandableListView.performItemClick(null, 0, -1); // open the group...
expandableListView.performItemClick(null, 6, -1);
transcript.assertEventsSoFar("item was clicked: 6");
}
示例10: holyCrapYouHaveGotToBeKidding
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
private SimpleExpandableListAdapter holyCrapYouHaveGotToBeKidding() {
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
for (int i = 0; i < 20; i++) {
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put("NAME", "Item " + i);
curGroupMap.put("IS_EVEN", (i % 2 == 0) ? "This group is even" : "This group is odd");
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 0; j < 5; j++) {
Map<String, String> curChildMap = new HashMap<String, String>();
children.add(curChildMap);
// curChildMap.put(NAME, "Child " + j);
curChildMap.put("IS_EVEN", (j % 2 == 0) ? "Hello " + j : "Good Morning " + j);
}
childData.add(children);
}
return new SimpleExpandableListAdapter(
Robolectric.application,
groupData,
R.layout.simple_expandable_list_item_1,
new String[] {"NAME", "IS_EVEN"},
new int[] {R.id.text1, R.id.text2},
childData,
R.layout.simple_expandable_list_item_2,
new String[] {"NAME", "IS_EVEN"},
new int[] {R.id.text1, R.id.text2}
);
}
示例11: clearUI
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
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);
}
示例12: onCreate
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edge_effect_expandablelistview_layout);
//this comes from android samples
List<Map<String, String>> groupData = new ArrayList<Map<String, String>>();
List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>();
for (int i = 0; i < 20; i++) {
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME, "Group " + i);
curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd");
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for (int j = 0; j < 15; j++) {
Map<String, String> curChildMap = new HashMap<String, String>();
children.add(curChildMap);
curChildMap.put(NAME, "Child " + j);
curChildMap.put(IS_EVEN, (j % 2 == 0) ? "This child is even" : "This child is odd");
}
childData.add(children);
}
// Set up our adapter
((EdgeEffectExpandableListView) findViewById(R.id.expandablelistview)).setAdapter(new SimpleExpandableListAdapter(
this,
groupData,
android.R.layout.simple_expandable_list_item_1,
new String[]{NAME, IS_EVEN},
new int[]{android.R.id.text1, android.R.id.text2},
childData,
android.R.layout.simple_expandable_list_item_2,
new String[]{NAME, IS_EVEN},
new int[]{android.R.id.text1, android.R.id.text2}
));
}
示例13: createActionsView
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
/**
* Creates the View containing the Plugin's actions.
*
* @return The View containing the Plugin's actions.
*/
private ScrollView createActionsView() {
LayoutParams fillParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
int padding = this.getResources().getDimensionPixelSize(R.dimen.padding);
ScrollView sv = new ScrollView(PluginActivity.this);
sv.setLayoutParams(fillParams);
sv.setPadding(padding, padding, padding, padding);
ExpandableListView elv = new ExpandableListView(PluginActivity.this) {
// workaround to get a ExpandableListView displayed in a ScrollView
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Calculate entire height by providing a very large height hint.
// But do not use the highest 2 bits of this integer; those are
// reserved for the MeasureSpec mode.
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
android.view.ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
};
elv.setLayoutParams(fillParams);
SimpleExpandableListAdapter sela = new PluginActionsExpandableListAdapter(this, PluginActivity.this,
createGroupList(), R.layout.group_row, new String[] { NAME }, new int[] { R.id.row_name },
createChildList(), R.layout.child_row, new String[] { DESC }, new int[] { R.id.grp_child });
elv.setAdapter(sela);
sv.addView(elv);
return sv;
}
示例14: getStreamingSourcesAdapter
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
@Override
public ExpandableListAdapter getStreamingSourcesAdapter()
{
// refer to: http://blog.denevell.org/android-SimpleExpandableListAdapter-example.html
// keys for our maps we'll be creating
final String KEY_GROUP_NAME = "GROUP_NAME";
final String KEY_CHILD_NAME = "STREAM_SOURCE";
// we only have one parent
List<Map<String, String>> listOfParents = new ArrayList<Map<String, String>>();
Map<String, String> parents = new HashMap<String, String>();
parents.put( KEY_GROUP_NAME, "Stream music from..." );
listOfParents.add( parents );
// that one parent has children; each child needs to be its own map, which may
// seem interesting, but it's required by SimpleExpandableListAdapter
List<List<Map<String, String>>> listOfChildLists = new ArrayList<List<Map<String, String>>>();
List<Map<String, String>> children = new ArrayList<Map<String, String>>();
for ( String value : m_streamingSourcesMgr.getAvailableStreamingSources().values() )
{
Map<String, String> child = new HashMap<String, String>();
child.put( KEY_CHILD_NAME, value );
children.add( child );
}
listOfChildLists.add( children );
ExpandableListAdapter adapter = new SimpleExpandableListAdapter( m_context,
listOfParents,
R.layout.streaming_sources_group_view,
new String[] { KEY_GROUP_NAME },
new int[] { R.id.streaming_sources_group_name },
listOfChildLists,
R.layout.streaming_sources_row_view,
new String[] { KEY_CHILD_NAME },
new int[] { R.id.streaming_sources_row_name } );
return adapter;
}
示例15: clearUI
import android.widget.SimpleExpandableListAdapter; //导入依赖的package包/类
private void clearUI() {
mGattServicesList.setAdapter((SimpleExpandableListAdapter) null);
mDataField.setText(com.igrow.android.R.string.no_data);
}