# android-ActionSheet
**Repository Path**: ForkedList/android-ActionSheet
## Basic Information
- **Project Name**: android-ActionSheet
- **Description**: iOS UIActionSheet for Android
- **Primary Language**: Java
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2016-01-08
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ActionSheet
[](http://android-arsenal.com/details/1/784)
[  ](https://bintray.com/baoyongzhang/maven/ActionSheet/_latestVersion)
This is like iOS UIActionSheet component, has iOS6 and iOS7 style, support custom style, background, button image, text color and spacing etc.
# Usage
### Add dependency
```groovy
dependencies {
compile 'com.baoyz.actionsheet:library:1.1.2'
}
```
### Create ActionSheet and show
```java
ActionSheet.createBuilder(this, getSupportFragmentManager())
.setCancelButtonTitle("Cancel")
.setOtherButtonTitles("Item1", "Item2", "Item3", "Item4")
.setCancelableOnTouchOutside(true)
.setListener(this).show();
```
### Methods
* `setCancelButtonTitle()` Cancel button title, (String)
* `setOtherButtonTitles()` Item buttons title,(String[])
* `setCancelableOnTouchOutside()` Touch outside to close, (boolean)
* `setListener()` set a Listener to listen event
* `show()` Show ActionSheet, return `ActionSheet` Object,call `dismiss()` method of `ActionSheet` to close.
### Listen event
implementing `ActionSheetListener` interface.
* `onOtherButtonClick()` Click item event,`index` is item index.
* `onDismiss()` Dismiss event.
```java
@Override
public void onOtherButtonClick(ActionSheet actionSheet, int index) {
Toast.makeText(getApplicationContext(), "click item index = " + index,
0).show();
}
@Override
public void onDismiss(ActionSheet actionSheet, boolean isCancle) {
Toast.makeText(getApplicationContext(), "dismissed isCancle = " + isCancle, 0).show();
}
```
### Style
Default style is bad,ActionSheet has iOS6 and iOS7 style,you can configure the theme.
```xml
```
You can custom style, can refer to ActionSheetStyleiOS6/ActionSheetStyleiOS7 writing.
```xml
```
### Style attributes
* `actionSheetBackground`
* `cancelButtonBackground`
* `otherButtonTopBackground`
* `otherButtonMiddleBackground`
* `otherButtonBottomBackground`
* `otherButtonSingleBackground`
* `cancelButtonTextColor`
* `otherButtonTextColor`
* `actionSheetPadding`
* `otherButtonSpacing`
* `cancelButtonMarginTop`
* `actionSheetTextSize`