I\'m developing an Android application.
How can I center the title for a custom dialog that I\'m using?
Similar to @LandL Partners solution, but in Kotlin:
val builder = AlertDialog.Builder(this)
val inflater = this.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val view = inflater.inflate(R.layout.viewname, null)
builder.setView(view)
val title = TextView(this)
title.setText("Custom Centered Title")
title.setBackgroundColor(Color.DKGRAY)
title.setPadding(10, 10, 10, 10)
title.setGravity(Gravity.CENTER)
title.setTextColor(Color.WHITE)
title.setTextSize(20)
builder.setCustomTitle(title)