I used to have one DialogFragmentthat I did not explicitly specify its interface components (Spinner, EditText).
dialog_fragment_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:orientation="vertical" >
<Spinner
android:id="@+id/country_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="200dp"
android:layout_marginBottom="10dp" />
<EditText
android:id="@+id/name_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions|textCapWords"
android:maxLength="50"
android:ems="10" >
<requestFocus />
</EditText>
</LinearLayout>
I use
- SherlockActionBar
- Theme.Sherlock.Light.DarkActionBar
- android: minSdkVersion = "10", android: targetSdkVersion = "21"
It looks like this

After switching to
- Appcompat
- Theme.AppCompat.Light.DarkActionBar
- android: minSdkVersion = "10", android: targetSdkVersion = "22"
It looks like the following

I was wondering if I am doing something wrong during my migration process? Is there a need for a specific color for DialogFragmentUI components (Spinner, EditText) explicitly?
, DialogFragment , Spinner, EditText... , , ( Spinner, EditText,...), SherlockActionBar?
: Activity DialogFragment. Application, , Activity DialogFragment Application.
<application
android:theme="@style/..." >
DialogFragment -
DialogFragment
public class MyDialogFragment extends android.support.v4.app.DialogFragment {
public static MyDialogFragment newInstance() {
return new MyDialogFragment();
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_fragment_layout, null);
final Spinner countrySpinner = (Spinner)view.findViewById(R.id.country_spinner);
final EditText nameEditText = (EditText)view.findViewById(R.id.name_edit_text);
final CountryArrayAdapter countryArrayAdapter = new CountryArrayAdapter(this.getActivity());
countrySpinner.setAdapter(countryArrayAdapter);
nameEditText.setHint(R.string.new_watchlist_hint);
nameEditText.setText(org.yccheok.jstock.watchlist.Utils.getDefaultWatchlistName());
Utils.placeCursorAtEndOfText(nameEditText);
final AlertDialog dialog = new AlertDialog.Builder(this.getActivity())
.setTitle(R.string.new_watchlist_title)
.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
})
.create();
dialog.setCanceledOnTouchOutside(true);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
Button b = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
...
}
});
}
});
return dialog;
}
DialogFragment
private void showMyDialogFragment() {
FragmentManager fm = this.getActivity().getSupportFragmentManager();
MyDialogFragment myDialogFragment = MyDialogFragment.newInstance();
myDialogFragment.setTargetFragment(this, 0);
myDialogFragment.show(fm, MY_DIALOG_FRAGMENT);
}