本文整理汇总了Java中android.widget.ExpandableListView.setOnChildClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java ExpandableListView.setOnChildClickListener方法的具体用法?Java ExpandableListView.setOnChildClickListener怎么用?Java ExpandableListView.setOnChildClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ExpandableListView
的用法示例。
在下文中一共展示了ExpandableListView.setOnChildClickListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RecentTabsPage
import android.widget.ExpandableListView; //导入方法依赖的package包/类
/**
* 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();
}
示例2: onContentChanged
import android.widget.ExpandableListView; //导入方法依赖的package包/类
/**
* 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 = (ExpandableListView) 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;
}
示例3: onCreate
import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(com.igrow.android.R.layout.gatt_services_characteristics);
final Intent intent = getIntent();
mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
// Sets up UI references.
((TextView) findViewById(com.igrow.android.R.id.device_address)).setText(mDeviceAddress);
mGattServicesList = (ExpandableListView) findViewById(com.igrow.android.R.id.gatt_services_list);
mGattServicesList.setOnChildClickListener(servicesListClickListner);
mConnectionState = (TextView) findViewById(com.igrow.android.R.id.connection_state);
mDataField = (TextView) findViewById(com.igrow.android.R.id.data_value);
getActionBar().setTitle(mDeviceName);
getActionBar().setDisplayHomeAsUpEnabled(true);
Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
}
示例4: onCreate
import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gatt_services_characteristics);
final Intent intent = getIntent();
mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);
// Sets up UI references.
((TextView) findViewById(R.id.device_address)).setText(mDeviceAddress);
mGattServicesList = (ExpandableListView) findViewById(R.id.gatt_services_list);
mGattServicesList.setOnChildClickListener(servicesListClickListner);
mConnectionState = (TextView) findViewById(R.id.connection_state);
mDataField = (TextView) findViewById(R.id.data_value);
getActionBar().setTitle(mDeviceName);
getActionBar().setDisplayHomeAsUpEnabled(true);
Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
示例5: onCreateView
import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_roots, container, false);
mList = (ExpandableListView) view.findViewById(android.R.id.list);
mList.setOnChildClickListener(mItemListener);
mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = Utils.dpToPx(302);
boolean rtl = Utils.isRTL();
int leftPadding = rtl ? 10 : 50;
int rightPadding = rtl ? 50 : 10;
int leftWidth = width - Utils.dpToPx(leftPadding);
int rightWidth = width - Utils.dpToPx(rightPadding);
if(Utils.hasJellyBeanMR2()){
mList.setIndicatorBoundsRelative(leftWidth, rightWidth);
} else {
mList.setIndicatorBounds(leftWidth, rightWidth);
}
return view;
}
示例6: onViewCreated
import android.widget.ExpandableListView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
user = (Profile) getArguments().getSerializable(ID_PROFILE);
noHabits = (TextView) view.findViewById(R.id.noHabits);
if (user.hasValidId())
user.load();
if (user.getHabits().size() > 0) {
noHabits.setVisibility(View.GONE);
}
user.synchronize();
// handle any habits that may have been missed since the user's last login
Date currentDate = new Date();
if (user.getLastLogin() != null && !DateUtilities.isSameDay(user.getLastLogin(), currentDate)) {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(user.getLastLogin());
// go through each date between the user's last login and the current date
while (!DateUtilities.isSameDay(calendar.getTime(), currentDate)){
// update all events at the end of that date, to make sure they are marked as missed if they weren't completed
// on that day
user.onDayEnd(calendar.getTime());
calendar.add(Calendar.DATE, 1);
}
}
user.setLastLogin(currentDate);
user.save();
// initialize the list displaying all habits the user has
expandableListView = (ExpandableListView) view.findViewById(R.id.HabitTypeExpandableListView);
adapter = new ExpandableListViewAdapter(getContext(), user);
expandableListView.setAdapter(adapter);
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int group, int child, long childRowId) {
String category = SetUtilities.getItemAtIndex(user.getHabitCategories(), group);
Habit habit = user.getHabitsInCategory(category).get(child);
ArrayList<String> types = new ArrayList<>();
types.addAll(user.getHabitCategories());
startDetailsActivity(habit, types);
return false;
}
});
}