msdx / Actionsheet
Licence: apache-2.0
ActionSheet for Android.
Programming Languages
java
68154 projects - #9 most used programming language
ActionSheet
ActionSheet for Android.
Installation
For non-Gradle project:
It's interesting.
###For Gradle project:
Include it into the dependencies section in your project's build.gradle
:
compile 'com.githang:actionsheet:[email protected]'
Usage
/**
* Create menu, add a menu item but set it invisible.
*/
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("menu").setVisible(false);// Create one and set invisible then the menu icon would not show in actionbar.
return super.onCreateOptionsMenu(menu);
}
/**
* Intercept the open menu event to show the custom menu.
*/
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
if (mActionSheetDialog == null) {
mActionSheetDialog = new ActionSheetDialog(this);
mActionSheetDialog.addMenuItem("Test1").addMenuItem("Test2");
mActionSheetDialog.setMenuListener(new ActionSheetDialog.MenuListener() {
@Override
public void onItemSelected(int position, String item) {
Toast.makeText(MainActivity.this, item, Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast.makeText(MainActivity.this, "onCancel", Toast.LENGTH_SHORT).show();
}
});
}
mActionSheetDialog.show();
return true;
}
You need to merge the node into your AppTheme
in styles.xml:
<item name="ActionSheetList">@style/ActionSheetList</item>
<item name="ActionSheetItem">@style/ActionSheetItem</item>
<item name="ActionSheetCancel">@style/ActionSheetCancel</item>
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].