Ja, ich weiß, dieses Problem wurde immer wieder hier gepostet. Aber ich kann keine Lösung für mein spezifisches Problem finden.Sie müssen ein Theme.AppCompat Thema verwenden
Jedes Mal, wenn ich versuche, eine Snackbar zu machen, meine App stürzt mit
You need to use a Theme.AppCompat theme (or descendant) with the design library.
Ok. Ich weiß: kein Debuggen ohne den Code, so:
The call, and line that throws the error:
Snackbar.make(
new CoordinatorLayout(getApplicationContext()),
"Logged out.",
Snackbar.LENGTH_SHORT).show();
The class definition:
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
Beginning of the manifest
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
Ach ja: Die AppTheme und AppTheme.NoActionbar sind beide Elternteile von Theme.AppCompat ...
Wenn Sie mehr Code benötigen, sagen Sie mir.
In 'res/Werte/styles.xml' und' res/Werte-v21/styles .xml' (wenn du es hast), bitte –