短視訊程式開發,簡易的自定義確認彈框AlertDialog
短視訊程式開發,簡易的自定義確認彈框AlertDialog實現的相關程式碼
CustomDialog(this, "清空輸入", "確定要清空已輸入內容嗎?", object : CustomDialog.ClickCallBack { override fun onYesClick(dialog: CustomDialog) { //點選確認按鈕後具體操作 dialog.dismiss() } }).show()
自定義Dialog程式碼:
/** * Created by Xinghai.Zhao * 自定義選擇彈框 */ @SuppressLint("InflateParams") class CustomDialog(context: Context?) : AlertDialog(context){ var mCallBack: ClickCallBack? = null var mTextViewTitle: TextView? = null var mTextViewContent: TextView? = null constructor(context: Context?, title: String?, content: String?, callBack: ClickCallBack) : this(context) { mCallBack = callBack if (title != null) mTextViewTitle?.text = title if (content != null) mTextViewContent?.text = content } init { val inflate = LayoutInflater.from(context).inflate(R.layout.dialog_custom, null) setView(inflate) //設定點選別的區域不關閉頁面 setCancelable(false) mTextViewTitle = inflate.findViewById(R.id.dialog_custom_title) mTextViewContent = inflate.findViewById(R.id.dialog_custom_content) inflate.findViewById<View>(R.id.dialog_custom_yes).setOnClickListener{mCallBack?.onYesClick(this)} inflate.findViewById<View>(R.id.dialog_custom_no).setOnClickListener{dismiss()} } interface ClickCallBack { fun onYesClick(dialog:CustomDialog) } }
佈局檔案:dialog_custom
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/white_circle_background10" android:orientation="vertical"> <TextView android:id="@+id/dialog_custom_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="20dp" android:textColor="@color/TextBlack" android:textSize="@dimen/TextSizeTitle" /> <TextView android:id="@+id/dialog_custom_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:paddingBottom="20dp" android:textColor="@color/TextGray" android:textSize="@dimen/TextSizeContent" /> <TextView android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/LightGrayStill" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/dialog_custom_no" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:padding="10dp" android:text="取消" android:textColor="@color/TextGray" android:textSize="@dimen/TextSizeContent" /> <TextView android:layout_width="1dp" android:layout_height="match_parent" android:background="@color/LightGrayStill" /> <TextView android:id="@+id/dialog_custom_yes" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:padding="10dp" android:text="確認" android:textColor="@color/TextGray" android:textSize="@dimen/TextSizeContent" /> </LinearLayout> </LinearLayout>
以上就是 短視訊程式開發,簡易的自定義確認彈框AlertDialog實現的相關程式碼,更多內容歡迎關注之後的文章
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2846721/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 直播系統原始碼,簡易的自定義確認彈框AlertDialog原始碼
- 短視訊商城系統,系統提示框、確認框、點選空白關閉彈出框
- 短視訊平臺開發,自定義一個彈窗樣式和內容
- android短視訊開發,自定義下拉選單Android
- Android 自定義 AlertDialog 提示框Android
- 短視訊開發app,自定義帶進度條的視訊播放按鈕APP
- 短視訊開發app,webservice自定義加入攔截器APPWeb
- 自定義popup彈出框
- iOS自定義控制元件:精簡的底部彈框iOS控制元件
- 短視訊平臺原始碼,自定義上傳有邊框的背景圖片原始碼
- 短視訊直播系統開發直播短視訊程式搭建短視訊互動直播
- 直播平臺軟體開發,簡單易修改的彈框元件元件
- AlertDialog 自定義對話方塊檢視
- 短視訊app開發,左滑刪除或長按彈出刪除選擇框APP
- 短視訊平臺開發,點選輸入框時自動彈出軟鍵盤
- iOS開發 AVFoundation 自定義視訊錄製iOS
- 短視訊直播原始碼,自定義圖片或視訊的迴圈播放原始碼
- JavaScript ·刪除 confirm彈出確認框JavaScript
- 短視訊商城在ios短視訊開發上的應用效果iOS
- 短視訊平臺搭建,自定義滾動條的樣式
- 自定義相機採集及視訊編輯(1)-短視訊錄製
- Laravel-admin grid 自定義按鈕並彈出模態框再次進行確認(基礎使用)Laravel
- android短視訊開發,自定義更改平臺主題以及狀態列樣式Android
- 點選連結a彈出一個確認框例項程式碼
- javascript實現點選彈出確認刪除警告框程式碼JavaScript
- 短視訊直播系統,Vue實現element-ui彈框可以拖拽VueUI
- js實現的點選彈出確認視窗程式碼JS
- 短視訊程式開發,RecyclerView自帶的滾動條View
- layUI layer彈框按鈕 : 確認,取消,關閉事件UI事件
- video標籤製作簡易版彈幕視訊IDE
- 短視訊技術詳解:Android端的短視訊開發技術Android
- js刪除操作時confirm()彈出確認框程式碼例項JS
- 短視訊平臺原始碼,自定義流式佈局--kotlin原始碼Kotlin
- 短視訊app開發之ios小視訊開發經驗共享APPiOS
- 自定義簡單彈幕實現
- 線上直播原始碼,自定義AlertDialog設定寬高並去掉預設的邊框原始碼
- 安卓自定義的AlertDialog的一些使用安卓
- 記錄Element Popconfirm 彈出確認框 事件踩坑事件