AlertDialog with Light Theme on Android 2.3.3 -
my app uses holo light works fine, on 2.3.3. when comes alertdialog, dialog still dark on 2.3.3. tried different themes on contextthemewrapper, none of them works.
this code create builder in oncreatedialog:
contextthemewrapper context = new contextthemewrapper(getactivity(), android.r.style.theme_light); alertdialog.builder builder = new alertdialog.builder(context); view view = inflater.inflate(r.layout.mydialog, null); builder.setview(view) .settitle(getactivity().getstring(r.string.mydialogcaption)); return builder.create();
i tried differnent values theme, ones appcompat library, dialog still dark. activities light defined in androidmanifest:
android:theme="@style/theme.appcompat.light"
how can make dialog light?
in short, android 2.3 doesn't have alertdialog.light theme. don't think have anyway use system's light alertdialog on android 2.3.
and if have designed theme view, example, r.style.light. i'd suggest use
layoutinflater.from(new contextthemewrapper(getactivity(), r.style.light))
to inflater.
for me, use dark dialog theme on android 2.3. , if want apply light theme, can below:
1). define alertdialog.light (other name ok), contains following items alertdialog.holo.light in api-14. (ref: http://developer.android.com/reference/android/r.styleable.html#alertdialog)
<item name="android:fulldark"></item> <item name="android:topdark"></item> <item name="android:centerdark"></item> <item name="android:bottomdark"></item> <item name="android:fullbright"></item> <item name="android:topbright"></item> <item name="android:centerbright"></item> <item name="android:bottombright"></item> <item name="android:bottommedium"></item> <item name="android:centermedium"></item>
2). defind theme, , reference dialog theme
<item name="android:alertdialogstyle"></item>
but think, let alertdialog in android 2.3 dark, take customization. here commit when try fix android 2.3 light theme probolem in xprivacy: https://github.com/liudongmiao/xprivacy/commit/13762c
Comments
Post a Comment