@Composable fun CustomDialog( onNegativeClick: () -> Unit, onPositiveClick: () -> Unit, ) { Dialog( onDismissRequest = { //Executes when dialog is dismissed }, ) { Column( modifier = Modifier .background(Color(0xff2c3e50)) .fillMaxWidth() ) { Box( modifier = Modifier .fillMaxWidth() ) { val view: View = LayoutInflater.from(LocalContext.current).inflate(R.layout.info_fragment, null) AndroidView( factory = { view }, modifier = Modifier.fillMaxWidth() ) val imageView = view.findViewById<ImageView>(R.id.pic) imageView.setOnClickListener { //Perform action for Imageview click event } } Row( horizontalArrangement = Arrangement.End, verticalAlignment = Alignment.CenterVertically, modifier = Modifier .fillMaxWidth() .background( Color(0xff2c3e50) ) ) { TextButton(onClick = onNegativeClick) { Text( text = "Cancel", style = TextStyle( fontSize = 16.sp, color = Color.White) ) } Spacer(modifier = Modifier.width(4.dp)) TextButton(onClick = { onPositiveClick() }) { Text(text = "Ok", style = TextStyle( fontSize = 16.sp, color = Color.White ) ) } } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter