Using private styles (no resource matching the specified name was found)

I want to apply a style similar to Graphical Layout , like Theme.DeviceDefault.Dialog.Alert . I know that now this is a private style, and I can not consider him a parent.

What can I do to have this style for my DialogFragment ?

(I am targeting API 15, and maybe I want to use minSdk API 12).

This tells me the error (the parent, as I read, is now closed):

 <style name="MyDialogStyle" parent="@android:style/Theme.DeviceDefault.Dialog.Alert"> 

No resource found matching the specified name.

I just read that I need to “copy” style elements, but I did not find where it is?

Can someone help me please? I need to "clone" this style into my own style.

Thanks in advance.

What I tried:

Hard code 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 visited these links:

http://developer.android.com/reference/android/app/AlertDialog.html http://developer.android.com/guide/topics/ui/themes.html

http://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=18659

No resource found matching the given name "@android: style / AlertDialog" after the last sdk update for Android 3.2.

http://daniel-codes.blogspot.com/2011/08/new-to-android-more-style-restrictions.html

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml

https://android.googlesource.com/platform/frameworks/base/+/d11e6151fe88314505fa7adca6278de2e772b11c/core/res/res/values/themes_device_defaults.xml

+4
source share
1 answer

Finally, I solved this problem with Dialog instead of a DialogFragment , because this last one does not support the transparency layout. It's easy to set a transparent background by creating a new activity and set the style in Manifest . Otherwise, I had to change the structure of the dialogs using actions instead of fragments.

Hope this saves you many hours of research.

Bye!

+1
source

All Articles