У меня есть DialogFragment, который показывает некоторую информацию. Это хорошо работает, но мне нужен другой заголовок, мне нужен белый цвет текста заголовка и синий фон заголовка. Это мой XML:Изменить цвет фона заголовка в диалоговом окне DialogFragment
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:id="@+id/icon_teacher"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/teacher"
android:id="@+id/teacher"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/icon_teacher"
android:layout_toRightOf="@+id/icon_teacher"
android:layout_toEndOf="@+id/icon_teacher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_of_teacher"
android:textColor="@android:color/black"
android:textSize="16dp"
android:id="@+id/teacher_name"
android:layout_below="@+id/teacher"
android:layout_alignLeft="@+id/teacher"
android:layout_alignStart="@+id/teacher" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:id="@+id/icon_time"
android:layout_below="@+id/icon_teacher"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/teacher"
android:id="@+id/time"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/icon_time"
android:layout_toRightOf="@+id/icon_time"
android:layout_toEndOf="@+id/icon_time" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_of_teacher"
android:textColor="@android:color/black"
android:textSize="16dp"
android:id="@+id/time_name"
android:layout_below="@+id/time"
android:layout_alignLeft="@+id/time"
android:layout_alignStart="@+id/time" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:id="@+id/icon_place"
android:layout_below="@+id/icon_time"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/teacher"
android:id="@+id/place"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/icon_place"
android:layout_toRightOf="@+id/icon_place"
android:layout_toEndOf="@+id/icon_place" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_of_teacher"
android:textColor="@android:color/black"
android:textSize="16dp"
android:id="@+id/place_name"
android:layout_below="@+id/place"
android:layout_alignLeft="@+id/place"
android:layout_alignStart="@+id/place" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:id="@+id/icon_home"
android:layout_below="@+id/icon_place"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/teacher"
android:id="@+id/home"
android:layout_marginLeft="10dp"
android:layout_alignTop="@+id/icon_home"
android:layout_toRightOf="@+id/icon_home"
android:layout_toEndOf="@+id/icon_home" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_of_teacher"
android:textColor="@android:color/black"
android:textSize="16dp"
android:id="@+id/place_home"
android:layout_below="@+id/home"
android:layout_alignLeft="@+id/home"
android:layout_alignStart="@+id/home" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/divider1"
android:layout_below="@+id/icon_home"
android:layout_marginTop="10dp"
android:background="@android:color/darker_gray"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/divider1"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_marginLeft="10dp"
android:id="@+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/alert"
android:id="@+id/alert"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
И мой DialogFragment, но я думаю, что это не будет полезно так:
public class LessonDialogFragment extends DialogFragment {
View view;
String title;
public LessonDialogFragment(String title) {
this.title = title;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.detail_dialog_fragment, container, false);
getDialog().setTitle(title);
return view;
}
}
Я не знаю, как изменить его, может быть, вы можете мне помочь ,