I am styling my AlertDialog
. I have successfully been able to style the background (see its blue) and the single choice items (see they are white with orange text).
Is it possible to style the AlertDialog
title background, the footer submit button and footer background? See the image below for these areas highlighted in red. Is it possible to make the AlertDialog
to have rounded rectangle corners?
As you can see I can set the title label background colour to blue but not the whole title background?
Implementation:
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(mActivity, R.style.AlertDialogCustom));
builder.setTitle("Select");
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(
getActivity(), R.layout.choices, choices);
builder.setSingleChoiceItems(adapter, -1, myOnClickListener);
// Styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AlertDialogCustom" parent="@android:style/Theme.Dialog">
<item name="android:textColor">#00FF00</item>
<item name="android:textSize">10sp</item>
<item name="android:background">#0000ff</item>
<item name="android:fontFamily">fonts/myCustomFont.ttf</item>
</style>
</resources>
// choices.xml
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:fontFamily="fonts/myCustomFont.ttf"
android:textColor="@color/theme_orange"
android:gravity="center_vertical"
android:ellipsize="marquee"
android:text="Text"
android:background="#fff"
android:paddingLeft="16dip"
android:paddingRight="7dip"/>