# iosDialog **Repository Path**: jiangbikuan/ios-dialog ## Basic Information - **Project Name**: iosDialog - **Description**: ios样式的弹窗和对话框 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-02-07 - **Last Updated**: 2024-03-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: dialog, Android, 仿ios ## README ### 依赖方式: ``` allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { implementation 'com.gitee.jiangbikuan:ios-dialog:v1.0' } ``` ### 功能使用 #### AlertDialog的方法: |方法说明|调用方法| |--|--| |构建AlertDialog|builder()| |设置dialog标题|setTitle(String str)| |设置标题文字大小|setTitleTextSize(float size)| |设置dialog内容|setMsg(String str)| |设置内容文字大小|setMsgTextSize(float size)| |设置确定按钮以及点击时间,默认没有确定按钮|setPositiveButton(String text, View.OnClickListener listener)| |设置取消按钮以及点击事件|setNegativeButton(String text, View.OnClickListener listener)| |设置按钮文字大小| setButtonTextSize(float size)| |点击返回键是否关闭| setCancelable(boolean cancel)| #### 调用案例 ``` new AlertDialog(this).builder() .setTitle("测试Ios版本弹窗") .setMsg("这里是弹窗内容") .setTitleTextSize(24f) .setMsgTextSize(20f) .setCancelable(false) .setButtonTextSize(16f) .show(); ``` #### ActionSheetDialog的方法 |方法说明|调用方法| |--|--| |构建ActionSheetDialog|builder()| |设置dialog标题|setTitle(String str)| |设置标题文字大小|setTitleTextSize(float size)| |添加条目,多次调用|addSheetItem(String strItem, SheetItemColor color, OnSheetItemClickListener listener)| |设置条目文字大小|setItemTextSize(float size)| |点击返回键是否关闭| setCancelable(boolean cancel)| |点击外部是否关闭| setCanceledOnTouchOutside(boolean cancel)| #### 调用案例 ``` new ActionSheetDialog(this) .builder() .setTitle("请上传照片") .setTitleTextSize(18f) .setCancelable(false) .setCanceledOnTouchOutside(false) .addSheetItem("拍照", ActionSheetDialog.SheetItemColor.Red, which -> { }) .addSheetItem("从手机相册选择", ActionSheetDialog.SheetItemColor.Blue, which -> { }) .setItemTextSize(20f) .show(); ```