我的应用程序(它是一个工具栏)上的ActionBar不显示UP按钮的图标,也没有显示溢出菜单,只是一个白色条。 然而,这些仍然有效 - 如果你触摸它们应该是。他们根本没有出现。ActionBar:向上图标和溢出菜单图标没有出现,但正在工作
我将主题,XML和清单与我的旧应用程序进行了比较,这些应用程序没有共享相同的问题,并且没有发现任何区别。所以我完全失去了。
样式xml的
<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= "AppTheme">
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
activity_main.xml中
<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:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.xu.servicequalityrater.CameraActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<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" >
<TextView android:textSize="20dp" android:textColor="@color/black" android:layout_gravity="center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Veritas" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
清单摘录
<activity
android:name=".CameraActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme_NoActionBar" />
由会员有什么建议谁面临类似的问题是非常欢迎!
你是正确的,我用白色作为我主颜色。我只是尝试了你的建议,没有改变:(编辑:只是改变了我的主要颜色为黑色,并且所有的图标都显示出来了,这是一个颜色问题,谢谢你,我会调整这个,直到我得到白色的工作 –
我有使用相同的主题和它的工作正常 – FAT
如果我的答案似乎有用,我希望你会给一个加票。:) – FAT