Android-Layoutfehler: "Ressourcen-ID & lt; res_id & gt; ist nicht vom Typ STYLE (stattdessen attr) "
Sehe ich ein Fehler habe ich noch nie gesehen w/Android, die verhindern möchten, dass einige meiner layout-Dateien von der Darstellung in Eclipse. Sie machen Ordnung zur Laufzeit.
Den Fehler, zeigt sich in der grafischen layout-editor (und meine Fehler-log) ist:
"Ressource id 0x1010081 ist nicht der Typ STIL (statt attr)"
Ich gesucht habe für die Ressource-id 0x1010081 in mein R-Dateien, und ich finde, es ist nicht so dass ich vermute, dass vielleicht irgendwie ich habe einen Konflikt mit einem eingebauten Android-attr. Ich habe auch überprüft, dass alle meine style-Attribute unten, zeigen Sie auf den aktuellen styles und nicht attr. Jede Hilfe zu schätzen.
Hier meine komplette layout-code:
<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>
Und hier ist meine styles.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>
Und hier ist mein custom 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>
InformationsquelleAutor der Frage Karim Varela | 2013-02-07
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ich habe auch dieses problem, mit den gleichen Ressourcen-ID angezeigt. Es verschwindet, wenn ich das ändern
android:spinnerMode
zu"dialog"
so dass ich vermute, es ist nicht ein problem mit Ihrem code.Die id in Frage, die bezieht sich auf die android-Attribut
spinnerStyle
. Sehen Sie, der doc für R. attrFand ich ein workaround, nämlich ersetzen
android:spinnerMode="dropdown"
mit
android:spinnerStyle="@android:style/Widget.Spinner.DropDown"
.InformationsquelleAutor der Antwort JulianSymes
Haben Sie versucht, die änderung der jede style-Eigenschaft, so etwas wie dieses:
InformationsquelleAutor der Antwort D. Tran
Als JulianSymes sagt, das problem ist
Seine Lösung (ersetzen Sie für
android:spinnerStyle="@android:style/Widget.Spinner.DropDown"
) läuft auf meinem Handy aber nicht auf meinem tabletMeine Lösung ist einfacher: LÖSCHEN Sie DIE ZEILE.
spinnerMode="dropdown"
ist standardmäßig, daher ist es unnecesaryInformationsquelleAutor der Antwort Carlos Gómez
Löschen Sie alle
style
Elemente und fügen Sie Sie dann einer nach dem anderen und immer überprüfen, ob es immer noch macht. So kann man zumindest herausfinden, welche einem die Schuld.InformationsquelleAutor der Antwort Ridcully
Als Google aus auf diese Seite verwiesen für diesen Fehler, und zum Wohle der Nachwelt...
In meinem Fall, in einer Laune heraus habe ich geschlossen und wieder geöffnet eclipseund Zack, war der Fehler Weg und eclipse hatte kein problem, das Rendern der Vorschau.
Obwohl ich glaube stark, dass dies möglicherweise nicht der Fall für alle.
Wenn Sie denken, Sie haben getan alles richtigdenke ich, wird es nicht Schaden, das Neustarten von eclipse.
InformationsquelleAutor der Antwort Samuel