Я устраиваю свой AlertDialog
. Я успешно смоделировал фон (см. Его синий) и отдельные элементы выбора (см. Белый цвет с оранжевым текстом).Стиль AlertDialog Отправить кнопка и название
Можно ли стиль фона заголовка AlertDialog
, нижний колонтитул представить кнопку и нижний колонтитул фона? См. Изображение ниже для этих областей, выделенных красным. Можно ли сделать AlertDialog
круглыми прямоугольными углами?
Как вы можете видеть, я могу установить цвет фона метки ярлыка на синий, но не весь фон заголовка?
Реализация:
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"/>