當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleExpandableListAdapter類代碼示例

本文整理匯總了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;
}
 
開發者ID:sevencore,項目名稱:BLEFOTA,代碼行數:24,代碼來源:BflFwUploader.java

示例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;
}
 
開發者ID:badnetmask,項目名稱:SaldoTicket,代碼行數:17,代碼來源:TransactionsActivity.java

示例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;
}
 
開發者ID:badnetmask,項目名稱:SaldoTicket,代碼行數:17,代碼來源:TransactionsShortActivity.java

示例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);
}
 
開發者ID:ZacharyTech,項目名稱:android-BluetoothLowEnergy,代碼行數:8,代碼來源:DeviceControlActivity.java

示例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);
}
 
開發者ID:haodynasty,項目名稱:AndroidBleManager,代碼行數:8,代碼來源:DeviceControlActivity.java

示例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);
}
 
開發者ID:chongbo2013,項目名稱:OverPulltorefresh,代碼行數:37,代碼來源:PullToRefreshExpandableListActivity.java

示例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 });
}
 
開發者ID:zserge,項目名稱:anvil-examples,代碼行數:28,代碼來源:ExpandableListLayout.java

示例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);
}
 
開發者ID:luoqii,項目名稱:ApkLauncher,代碼行數:37,代碼來源:ExpandableList3.java

示例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");
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:13,代碼來源:ExpandableListViewTest.java

示例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}
  );
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:32,代碼來源:ExpandableListViewTest.java

示例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);
}
 
開發者ID:alt236,項目名稱:Bluetooth-LE-Library---Android,代碼行數:9,代碼來源:DeviceControlActivity.java

示例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}
    ));
}
 
開發者ID:cymcsg,項目名稱:UltimateAndroid,代碼行數:38,代碼來源:ExpandableListViewActivity.java

示例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;
   }
 
開發者ID:credentials,項目名稱:irma_future_id,代碼行數:37,代碼來源:PluginActivity.java

示例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;
}
 
開發者ID:awood82,項目名稱:RoviRunner,代碼行數:40,代碼來源:MainActivityPresenter.java

示例15: clearUI

import android.widget.SimpleExpandableListAdapter; //導入依賴的package包/類
private void clearUI() {
    mGattServicesList.setAdapter((SimpleExpandableListAdapter) null);
    mDataField.setText(com.igrow.android.R.string.no_data);
}
 
開發者ID:igrow-systems,項目名稱:igrow-android,代碼行數:5,代碼來源:DeviceControlActivity.java


注:本文中的android.widget.SimpleExpandableListAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。