Answer the question
In order to leave comments, you need to log in
How to change AlertDialog line color?
How to change linny color from pink to any other?
val dialog = AlertDialog.Builder(requireContext(), R.style.AlertTheme)
.setTitle(getString(R.string.enter_problem_reason))
.setView(reasonEditText)
.setCancelable(true)
.setPositiveButton(getString(R.string.ok)) { dialog, _ ->
onReasonGiven(reasonEditText.text.toString())
hideKeyboardFrom(requireContext(), reasonEditText)
dialog.cancel()
}
.setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
dialog.cancel()
}
.create()
dialog.show()
<style name="AlertTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:background">@color/color_gray_background</item>
<item name="android:textColor">@color/white</item>
<item name="android:textColorPrimary">@color/white</item>
</style>
Answer the question
In order to leave comments, you need to log in
I see that reasonEditText is used here, in which this color is pink by default.
Solution:
for example, I will create a reasonEditText programmatically, maybe you also create it either through markup, then you will need to set a backgroundTint and specify @drawable/bg_edittext in it
val reasonEditText = EditText(requireContext())
reasonEditText.setBackgroundDrawable(requireContext().getDrawable(R.drawable.bg_edittext))
val dialog = AlertDialog.Builder(requireContext(), R.style.AlertTheme)
.setTitle("Причина приостановки подписки")
.setView(reasonEditText)
.setCancelable(true)
.setPositiveButton("Ок") { dialog, _ ->
dialog.cancel()
}
.setNegativeButton("Отмена") { dialog, _ ->
dialog.cancel()
}
.create()
dialog.show()
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape>
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@color/error_red" />
</shape>
</item>
</layer-list>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question