2016-06-09 3 views
1

Ich habe auf anderen Posts nach Antworten gesucht, bin mir aber immer noch nicht sicher, wo ich falsch liege. Ich erhalte diesen Fehler jedes Mal, wenn ich versuche, die Aktivität zu starten. xmlFehler: Für diese Aktivität wurde bereits eine Aktionsleiste vom Fensterdekor bereitgestellt

Arten

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

<style name="AppTheme.NoActionBar" parent = "Theme.AppCompat.NoActionBar"> 
    <item name="android:windowActionBar">false</item> 
    <item name="android:windowNoTitle">true</item> 
</style> 

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

Aktivität Admin Control xml

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/Theme.AppCompat.NoActionBar"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" 
     /> 

</android.support.design.widget.AppBarLayout> 

<include layout="@layout/content_admin_control" /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@android:drawable/ic_input_add" /> 

Admincontrol Aktivität

public class AdminControl extends AppCompatActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_admin_control); 
     Toolbar b = (Toolbar) findViewById(R.id.toolbar); 
     b.setTitle("Tournaments"); 
     getSupportActionBar().hide(); 
     setSupportActionBar(b); 
    } 

    public void createNewTournament(View v) { 
     Intent newIntent = new Intent(this, TournamentCreator.class); 
     startActivity(newIntent); 
    } 
} 

Android Manifest

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.kaushikshivakumar.vexteamqueuing"> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <!-- To auto-complete the email text field in the login form with the user's emails --> 
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.READ_PROFILE" /> 
    <uses-permission android:name="android.permission.READ_CONTACTS" /> 

    <application 
     android:name=".VEXQueuing" 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".Initial"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name=".AdminLogin" 
      android:label="@string/title_activity_admin_login" 
      android:parentActivityName=".Initial"> 
      <meta-data 
       android:name="android.support.PARENT_ACTIVITY" 
       android:value="com.example.myname.vexteamqueuing.Initial" /> 
     </activity> 
     <activity android:name=".TournamentCreator" /> 
     <activity 
      android:name=".AdminControl" 
      android:label="@string/title_activity_admin_control" 
      android:parentActivityName=".Initial" 
      android:theme="@style/AppTheme.NoActionBar"> 
      <meta-data 
       android:name="android.support.PARENT_ACTIVITY" 
       android:value="com.example.myname.vexteamqueuing.Initial" /> 
     </activity> 
    </application> 

</manifest> 
+1

Zeigen Sie bitte Ihre AndroidManifest.xml. – user35603

+0

hast du noch andere styles.xml? wahrscheinlich wird es von der API-Version – jmsalcido

Antwort

0

Es scheint in Ihrem AndroidManifest.xml Sie haben android:theme="@style/AppTheme" in der Anwendung Tag. Ändern Sie es in android:theme="@style/AppTheme.NoActionBar". Und

<android.support.design.widget.AppBarLayout 
    //... 
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar"> 

     <android.support.v7.widget.Toolbar 
     //... 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

</android.support.design.widget.AppBarLayout> 
+1

überschrieben, klingt das könnte das Problem sein, aber auch überprüfen, dass alle Ihre Stile korrekt sind. – jmsalcido

+0

Ich habe mein Manifest gepostet; Ich lege das Thema für diese Aktivität im Manifest auf keine Aktionsleiste fest, aber es gibt mir immer noch den Fehler. Danke für Ihre Hilfe. – kmindspark

Verwandte Themen