0

Я практикую учебник. Приложение прекрасно работало, прежде чем я включил просмотр списка. Теперь панель действий и опции меню исчезли. Может ли кто-нибудь помочь мне определить проблему. Ниже приведен код (пожалуйста, сообщите, требуется ли дополнительная информация).Панель действия и опции меню отсутствуют - Android

activity_home.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".HomeActivity" 
    tools:showIn="@layout/activity_home"> 


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



    <ListView 
     android:id="@android:id/list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
    </ListView> 
</RelativeLayout> 

styles.xml

<resources> 

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

</resources> 

manifest.xml

<application 
     android:name=".Application" 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     > 

     <activity 
      android:name=".HomeActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name=".LoginActivity" 
      android:label="@string/title_activity_register" 
      android:theme="@style/AppTheme.NoActionBar" /> 
     <activity 
      android:name=".RegisterActivity" 
      android:label="@string/title_activity_login" 
      android:theme="@style/AppTheme.NoActionBar" /> 
     <activity 
      android:name=".UpdateStatusActivity" 
      android:label="@string/title_activity_update_status" 
      android:theme="@style/AppTheme.NoActionBar"></activity> 
    </application> 

</manifest> 
+2

Вот решение - http://stackoverflow.com/questions/12320775/action-bar-menu-button-missing –

+1

Вот ** решение ** - http://stackoverflow.com/questions/12320775/ действие бар-меню кнопки пропущенного –

ответ

0

Чанг е

android:theme="@style/AppTheme.NoActionBar" 

в файле AndroidManifest.xml для

android:theme="@style/AppTheme" 

Он должен работать.

1

В манифесте вы упомянули AppTheme в качестве темы приложения, но для каждого вида деятельности вы упомянули тему, как AppTheme.NoActionBar Для HomeActivity вам нужно использовать AppTheme вместо NoActionBar темы Просто удалите

android:theme="@style/AppTheme.NoActionBar" 

От вашей активности тега в манифесте для HomeActiviy

0

вы использовали в manifest.xml файл android:theme="@style/AppTheme.NoActionBar" не писать андроид: лейтмотив, если вы не можете изменить тему