0

错误信息

error: Error: No resource found that matches the given name (at 'style' with value '@style/rightBehindMenuScroll').

布局/activity_behind_right_simple.xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/rightBehindMenuScroll" >

    <LinearLayout style="@style/behindMenuScrollContent"
        android:paddingTop="25dp" >
        <TextView
            style="@style/behindMenuItemTitle"
            android:text="Right" />
        <TextView
            style="@style/behindMenuItemLabel"
            android:text="Item0" />
        <TextView
            style="@style/behindMenuItemLabel"
            android:text="Item1" />
        <Button
            android:id="@+id/behind_btn"
            style="@style/behindMenuItemLabel"
            android:text="BUTTON" />
    </LinearLayout>
</ScrollView>

值/样式.xml

<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>


    <style name="leftBehindMenuScroll">
        <item name="android:layout_width">240dp</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:background">@drawable/leftbg</item>
    </style>
    <style name="rightBehindMenuScroll">
        <item name="android:layout_width">200dp</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:background">@drawable/rightbg</item>
    </style>
    <style name="behindMenuScrollContent">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:orientation">vertical</item>
        <item name="android:padding">8dp</item>
    </style>
    <style name="behindMenuItemTitle">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginLeft">8dp</item>
        <item name="android:layout_marginBottom">8dp</item>
        <item name="android:textSize">22sp</item>
        <item name="android:textColor">#FFFFFF</item>
    </style>
    <style name="behindMenuItemLabel">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginLeft">8dp</item>
        <item name="android:layout_marginBottom">8dp</item>
        <item name="android:textSize">18sp</item>
        <item name="android:textColor">#FFFFFF</item>
    </style>

</resources>
4

1 回答 1

1

那是因为您使用的是styles.xml而不是style.xml。

尝试按如下方式更改引用...

 <TextView
            style="@styles/behindMenuItemTitle"
            android:text="Right" />

以同样的方式与styles.xml 文件的所有其他引用...

于 2013-08-10T14:14:45.747 回答