Ich habe einen toolbar.xml:android.widget.Toolbar kann nicht in android.support.v7.widget.Toolbar umgewandelt werden
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_primary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark" />
Ich habe einen Tag zu einem anderen meiner Tätigkeit Layouts sind:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme">
<include
layout="@layout/toolbar"
android:id="@+id/tb">
</include>
<android.support.v7.widget.RecyclerView
android:id="@+id/grade_list"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF" />
Und ich habe es in meiner Tätigkeit implementiert, die AppCompatActivity erweitert:
Toolbar toolbar;
toolbar = (Toolbar)findViewById(R.id.tb);
setSupportActionBar(toolbar);
Allerdings habe ich eine m erhält die folgende Fehlermeldung, wenn ich meine app laufen:
Error:(26, 29) error: incompatible types: android.widget.Toolbar cannot be converted to android.support.v7.widget.Toolbar
Außerdem, wenn ich mein Layout im Editor zu sehen, erhalte ich die folgende Meldung:
Missing styles. Is the correct theme chosen for this layout?
Use the theme combo box above the layout to choose a different layout, or to fix the theme style references.
Failed to find style 'toolbarStyle' in current layout.
Und meinen styles.xml:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/color_primary</item>
<item name="colorPrimaryDark">@color/color_primaryDark</item>
<item name="colorAccent">@color/color_accent</item>
<item name="colorControlNormal">@color/color_accent</item>
</style>
ich sehe nicht, wo ich falsch gehe. Das richtige Thema wird im Editor und in meiner Manifest-Datei ausgewählt. Alle Hilfe wird wie immer geschätzt!
an der Spitze Ihrer Tätigkeit dort hat 'Import android.support.v7.widget.Toolbar sein;' 'nicht import android.widget.Toolbar;' –