【问题标题】:Error:No resource found that matches the given name (at 'theme' with value '@style/MaterialTheme')错误:找不到与给定名称匹配的资源(在“主题”处,值为“@style/MaterialTheme”)
【发布时间】:2017-10-02 07:58:09
【问题描述】:

我正在尝试在 android studio 中开发一个对象检测应用程序,但它给了我一个错误。 错误在这一行android:theme="@style/MaterialTheme"

manifest.xml

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="23" />

    <application android:allowBackup="true"
        android:debuggable="true"
        android:label="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:theme="@style/MaterialTheme">

        <activity android:name="org.tensorflow.demo.ClassifierActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_classification">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="org.tensorflow.demo.DetectorActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_detection">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="org.tensorflow.demo.StylizeActivity"
                  android:screenOrientation="portrait"
                  android:label="@string/activity_name_stylize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest 

【问题讨论】:

  • 您检查过style.xml 文件吗?有上面提到的风格吗?
  • @ShobhitPuri res/values/styles.xml 位置没有文件,这意味着我必须添加它?
  • 除非您指定,否则您可以添加文件并为所有活动使用所需的任何默认主题。 developer.android.com/guide/topics/ui/look-and-feel/themes.html
  • @ShobhitPuri 谢谢
  • 让我知道这是否有效。否则,如果您不需要它,您可以尝试完全删除该属性。

标签: android tensorflow object-detection


【解决方案1】:

只是为了给出一个可能对稍后提出问题的其他人有所帮助的答案。如果您不需要任何自定义主题,则可以删除该属性。如果res/values 中尚不存在style.xml,则创建一个style.xml,并检查该特定&lt;style&gt;&lt;/style&gt; 资源是否存在。如果没有,那么您可以创建一个。希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2013-11-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 2015-02-10
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多