I don't know which code to post, so I just post the Code of DialogFragment:
public class dialog_ChangeActivity extends AppCompatDialogFragment {
private static final String TAG = "dialog_ChangeActivity";
private ArrayList<obj_Activity> activityList;
private Spinner sp_DialogChangeActivity;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
createArray();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_changeactivity, null);
builder.setView(view)
.setTitle("Change Activity");
builder.setNegativeButton("Cancle", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
sp_DialogChangeActivity = view.findViewById(R.id.sp_DialogChangeActivity);
adapter_Spinner_ChangeActivity ac = new adapter_Spinner_ChangeActivity(getContext(), activityList);
sp_DialogChangeActivity.setAdapter(ac);
return builder.create();
}
Everthing works fine, but the buttons "Ok" and "Cancel" are invisible, I don't know why...
This ist what it looks like if I click
Update 1
I tried:
<item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
<style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless.Colored</item>
</style>
with
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme);
Also I Changed the libary to import android.support.v7.app.AlertDialog;
Update 2
Okay, now I changed my styles.xml, to set the colort of the Text on the buttons manualy, but this gives me the buttons in default color, I don't know about that.
<style name="AlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:background">@color/Mercedes_WHITE</item>
<item name="android:textColor">@color/Mercedes_BLACK</item>
<item name="buttonStyle">@style/AlertButton</item>
<item name="borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless.Colored</item>
</style>
<style name="AlertButton">
<item name="android:textColor">@color/Mercedes_BLACK</item>
</style>