【问题标题】:Application has stopped Android [duplicate]应用程序已停止 Android [重复]
【发布时间】:2016-01-29 07:59:02
【问题描述】:

请帮帮我。

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".MainActivity">

    <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" />

【问题讨论】:

  • 请在问题中发布错误和代码,而不是图片。
  • 发布完整的 activity_main.xml 代码。
  • &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt; &lt;!-- Customize your theme here. --&gt; &lt;item name="colorPrimary"&gt;@color/colorPrimary&lt;/item&gt; &lt;item name="colorPrimaryDark"&gt;@color/colorPrimaryDark&lt;/item&gt; &lt;item name="colorAccent"&gt;@color/colorAccent&lt;/item&gt; &lt;/style&gt; &lt;style name="AppTheme.NoActionBar"&gt; &lt;item name="windowActionBar"&gt;false&lt;/item&gt; &lt;item name="windowNoTitle"&gt;true&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt;

标签: java android


【解决方案1】:

这个 Activity 已经有一个由窗口装饰提供的操作栏。 那是你的错误。 将您的活动主题更改为 NoActionBar 主题。它会解决你的问题。

<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
 ...
</style>

【讨论】:

  • 别忘了在标签活动中也将其放在清单上添加:android:theme="@style/NoActionBarTheme"
猜你喜欢
  • 2018-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-12
  • 2018-01-06
  • 2015-09-07
  • 1970-01-01
相关资源
最近更新 更多