Home » Android » android – no resource found that matches the given name Theme.Sherlock.Dialog

android – no resource found that matches the given name Theme.Sherlock.Dialog

Posted by: admin May 14, 2020 Leave a comment


Android 2.3.3

I have searched SO for a solution, but I couldn’t understand the solutions given. If someone can explain in a simple way on how to get rid of this error, I would be thankful.

I am using ActionBarSherlock in my application. My basic theme, Theme.Sherlock.Light, works fine with all the activities. For one activity, I want my activity to look like a dialog and hence I wanted to use Theme.Sherlock.Dialog.

Here is my manifest file’s declaration.

     android:theme="@style/Theme.Sherlock.Dialog" >

But I get the following error in my XML : error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.Sherlock.Dialog').. Why am I getting this? What should I do, to remove this?

How to&Answers:

Dialog themes in ActionBarSherlock were removed by JakeWharton over four months ago.


Just use @android:style/Theme.Dialog and extend Activity instead of SherlockActivity. ActionBarSherlock doesn’t do anything for dialogs and it will just complain if you’re not using one if its themes.


--- res/values-v14/abs__themes.xml
+++ res/values-v14/abs__themes.xml
@@ -26,9 +26,4 @@
       <item name="android:windowActionBar">false</item>
       <item name="android:windowNoTitle">true</item>
+    <style name="Theme.Sherlock.Dialog" parent="android:Theme.Holo.Dialog">
+    </style>
+    <style name="Theme.Sherlock.Light.Dialog" parent="android:Theme.Holo.Light.Dialog">
+    </style>


Theme.Sherlock.Dialog is not supported anymore. I use following approach to style my dialogs in DialogFragment. You can check my dialog templates.

public Dialog onCreateDialog(Bundle savedInstanceState)
    ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), getTheme(true));
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    return builder.create();

private int getTheme(boolean light)
        return light ? android.R.style.Theme_DeviceDefault_Light_Dialog : android.R.style.Theme_DeviceDefault_Dialog;
        return light ? android.R.style.Theme_Holo_Light_Dialog : android.R.style.Theme_Holo_Dialog;
        return android.R.style.Theme_Dialog;


There is no style in ABS as Theme.Sherlock.Dialog.

You may want that activity extend one of the flavors Dialog, e.g.:

    public class MyDialog extends Dialog {
        // Lots of code