10

Holo Light テーマで DatePickerDialog を取得するにはどうすればよいですか?

次のように を作成する場合DatePickerDialog:

 DatePickerDialog dpd = new DatePickerDialog(new ContextThemeWrapper(this,
                    android.R.style.Theme_Holo_Light_Dialog_NoActionBar), 
    new DateListener(v), mTime.year, mTime.month, mTime.monthDay);

またはテーマandroid.R.style.Theme_Holo_Lightまたはandroid.R.style.Theme_Holo_Light_Dialogを使用して、標準のタイトルと標準のボタンを備えた日付ピッカーを取得します。ホロライトの親でもカスタムテーマを使用しようとしましたが、うまくいきませんでした。themeandroid.R.style.Theme_Holoで動作するようですが、結果は(予想どおり)暗い背景ですが、明るい背景が欲しいです。

アプリケーションの android.jar はバージョン 14 で、アプリケーションは Android バージョン 3.2 のデバイスで実行されています。

私はここで例を見てきました: http://as400samplecode.blogspot.com/2011/10/android-datepickerdialog.html、これはDatePickerDialogホロライトテーマで、私が望む方法を示しています。なぜ私の設定でうまくいかないのかわかりません。

ご協力ありがとう御座います。

4

3 に答える 3

18

DatePickerDialogテーマを受け入れるコンストラクターがあります

DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)

コードを更新して、必要なスタイルを含めるだけです。ContextThemeWrapper

DatePickerDialog dpd = new DatePickerDialog(this,
                android.R.style.Theme_Holo_Light_Dialog_NoActionBar, 
new DateListener(v), mTime.year, mTime.month, mTime.monthDay);

それは私のために働いています。

于 2012-05-23T11:32:18.680 に答える