実現したいこと
OKボタンとキャンセルボタンにエフェクト効果をつけたいのですが、対応するXMLファイルがないためか以下のXMLコードでは実現できませんでした。どなたかご教授いただけませんでしょうか?
XML
1android:foreground="?android:selectableItemBackground"
以下は、kotlinコードです
kotlin
1 private fun showConfirmationDialog(pileId: Int) { 2 val builder = AlertDialog.Builder(requireContext(), R.style.AlertDialog) 3 builder.setTitle(Html.fromHtml("<b>" + getString(R.string.pilecheck_confirm_confirmtv) + "</b>")) 4 builder.setMessage(R.string.pilecheck_confirm_confirm_message) 5 6 builder.setPositiveButton(getString(R.string.ok)) { _, _ -> 7 mCheckPileViewModel.setSelectedPileId(pileId) 8 } 9 10 builder.setNegativeButton(getString(R.string.cancel)) { _, _ -> 11 } 12 13 val alertDialog: AlertDialog = builder.create() 14 15 alertDialog.setCancelable(false) 16 17 alertDialog.setOnShowListener { 18 val positiveButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE) 19 positiveButton.setTextColor( 20 ContextCompat.getColor( 21 requireContext(), 22 R.color.select_inspection_list_text_color 23 ) 24 ) 25 positiveButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20F) 26 positiveButton.setBackgroundResource(android.R.color.transparent) 27 28 val negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE) 29 negativeButton.setTextColor( 30 ContextCompat.getColor( 31 requireContext(), 32 R.color.select_inspection_list_text_color 33 ) 34 ) 35 negativeButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20F) 36 negativeButton.setBackgroundResource(android.R.color.transparent) 37 38 val messageBox = alertDialog.findViewById<TextView>(android.R.id.message) 39 messageBox?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20F) 40 } 41 alertDialog.show() 42 }
AlertDialogのボタンにエフェクトを付けようとしておられると見受けます。
どのようなエフェクトを付けたいのですか?
タップした際に波みたいな感じにしたいのですが・・・
以下のような感じです。
http://hikeshiya.hatenablog.com/entry/2018/03/07/211558