Issue
I want to apply a style like the Graphical Layout
shows as Theme.DeviceDefault.Dialog.Alert
. I know that it's a private style now, and I can't take it as parent.
What can I do to have that style to my DialogFragment
?
(I'm targeting API 15, and maybe I want to minSdk API 12).
This reports me an error (the parent, like I read, it's private now):
<style name="MyDialogStyle" parent="@android:style/Theme.DeviceDefault.Dialog.Alert">
No resource found that matches the given name.
I just read that I must "copy" the items of style, but I don't find where is it?
Could anyone help me, please? I need to "clone" that style to my custom style.
Thanks in advance.
Things I have tried:
Hardcoded background for DialogFragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO Auto-generated method stub
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));
return super.onCreateView(inflater, container, savedInstanceState);
}
My Custom Style
<style name="MyDialogStyle">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
I have visited these links:
http://developer.android.com/reference/android/app/AlertDialog.html http://developer.android.com/guide/topics/ui/themes.html
http://daniel-codes.blogspot.com/2011/08/new-to-android-more-style-restrictions.html
Solution
Finally I solved this problem with a Dialog
instead a DialogFragment
because this last one doesn't support transparency layout. It was easy set the transparent background making a new activity
and set the style in Manifest
. Otherwise I had to change the structure of dialogs using activities instead fragments.
I hope this saves someone many hours of research.
Bye!
Answered By - wendigo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.