Подтвердить что ты не робот

Ошибка размещения макета Android: "Идентификатор ресурса <res_id> не относится к типу STYLE (вместо attr)"

Я вижу ошибку, которую я никогда не видел перед w/Android, которая предотвращает рендеринг некоторых моих файлов макета в Eclipse. Они отлично работают во время выполнения.

Ошибка, отображаемая в графическом редакторе (и моем журнале ошибок): "Resouce id 0x1010081 не имеет типа STYLE (вместо attr)"

Я искал идентификатор ресурса 0x1010081 в своих R файлах, и я не могу его найти, поэтому я предполагаю, что каким-то образом я столкнулся с конфликтом со встроенным Android attr. Я также подтвердил, что все мои атрибуты стиля ниже указывают на фактические стили и не attr. Любая помощь была оценена.

Здесь мой полный код макета:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bkg_light"
    android:padding="@dimen/padding_med" >

    <RelativeLayout
        android:id="@+id/relativeLayout_activity"
        android:layout_width="fill_parent"
        android:layout_height="@dimen/button_height"
        android:background="@drawable/xml_button"
        android:padding="@dimen/padding_med" >

        <TextView            
            style="@style/text_large_bold_white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/activity" />

        <TextView
            android:id="@+id/textView_activity"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginRight="@dimen/margin_med"
            android:layout_toLeftOf="@+id/textView_arrow_right_start_date" 
            android:text="@string/none_selected"/>

        <TextView
            android:id="@+id/textView_arrow_right_start_date"
            style="@style/arrow_right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true" />
    </RelativeLayout>

    <!-- kv Duration -->

    <RelativeLayout
        android:id="@+id/relativeLayout_duration"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/relativeLayout_activity"
        android:layout_marginTop="@dimen/margin_large"
        android:background="@drawable/xml_button">

        <TextView
            android:id="@+id/textView_duration"
            style="@style/text_large_bold_white"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/duration_lc" 
            android:paddingLeft="@dimen/padding_med"/>

        <Spinner
            android:id="@+id/spinner_duration"
            android:layout_width="wrap_content"
            android:layout_height="@dimen/button_height"
            android:layout_alignParentRight="true"
            android:entries="@array/array_durations"
            android:prompt="@string/duration_lc"
            android:spinnerMode="dropdown" 
            android:clickable="false"/>
    </RelativeLayout>

</RelativeLayout>

И вот мои стили .xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="arrow_right">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_xxlarge</item>
        <item name="android:text">@string/arrow_right</item>
    </style>

    <style name="button_blue">
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:background">@drawable/selector_button_blue</item>
        <item name="android:padding">@dimen/padding_med</item>
    </style>

    <style name="button_blue_small">
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:background">@drawable/selector_button_blue_small</item>
        <item name="android:padding">@dimen/padding_med</item>
    </style>

    <style name="button_dark">
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:background">@drawable/selector_button_dark</item>
        <item name="android:padding">@dimen/padding_med</item>
    </style>

    <style name="button_light">
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/black</item>
        <item name="android:background">@drawable/selector_button_light</item>
        <item name="android:padding">@dimen/padding_med</item>
    </style>

    <style name="button_light_small">
        <item name="android:textStyle">bold</item>
        <item name="android:textColor">@color/black</item>
        <item name="android:textSize">@dimen/text_small</item>
        <item name="android:background">@drawable/selector_button_light</item>
        <item name="android:padding">@dimen/padding_small</item>
    </style>  

    <style name="text_small_gray_light">
        <item name="android:textSize">@dimen/text_small</item>
        <item name="android:textColor">@color/gray_light</item>
    </style>

    <style name="text_med_bold_gray_light">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_med</item>
        <item name="android:textColor">@color/gray_light</item>
    </style>    

    <style name="text_large_bold_white">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_large</item>
    </style>

    <style name="text_large_bold_black">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_large</item>
        <item name="android:textColor">@color/black</item>
    </style>

    <style name="text_large_bold_gray_dark">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_large</item>
        <item name="android:textColor">@color/gray_dark</item>
    </style>

    <style name="text_large_bold_gray_light">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_large</item>
        <item name="android:textColor">@color/gray_light</item>
    </style>

    <style name="text_large_bold_white">
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">@dimen/text_large</item>
        <item name="android:textColor">@color/white</item>
    </style>

    <style name="text_large_white">
        <item name="android:textSize">@dimen/text_large</item>
        <item name="android:textColor">@color/white</item>
    </style>
</resources>

И вот мой пользовательский theme.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="Theme.P90X" parent="@style/Theme.Sherlock">
        <item name="android:textColor">#ffffffff</item>
    </style>
</resources>
4b9b3361

Ответ 1

У меня также есть эта проблема, с тем же идентификатором ресурса. Он исчезает, когда я меняю android:spinnerMode на "dialog", поэтому я подозреваю, что это не проблема с вашим кодом.

Этот идентификатор относится к атрибуту android spinnerStyle. См. Документ для R.attr

Я нашел обходное решение, а именно заменить

android:spinnerMode="dropdown"

с

android:spinnerStyle="@android:style/Widget.Spinner.DropDown".

Ответ 2

Вы пытались изменить свойство каждого стиля на что-то вроде этого:

style="?attr/text_large_bold_white"

Ответ 3

Как отмечает JulianSymes, проблема

android:spinnerMode="dropdown"

Его решение (заменить на android:spinnerStyle="@android:style/Widget.Spinner.DropDown") выполняется на моем телефоне, но не на моем планшете

Мое решение проще: УДАЛИТЕ ЛИНИЮ.

spinnerMode="dropdown" по умолчанию, поэтому он ненужный

Ответ 4

Удалите все элементы style, а затем добавьте их один за другим и всегда проверяйте, все ли он отображается. Таким образом, вы можете хотя бы выяснить, какой из них виноват.

Ответ 5

Поскольку Google указывает на эту страницу для этой ошибки и ради потомства...

В моем случае, по прихоти, я закрыл и снова затмение затмения и стрелял, что ошибка исчезла, и затмение не имело проблем с рендерингом предварительного просмотра.

Хотя я твердо верю, что это может быть не для всех.

Если вы чувствуете, что сделали все правильно, я думаю, это не повредит перезапуску затмения.