2017-02-08 9 views
0

내가 새로운 활동을 할 때마다 왜 그런가요?새로운 활동을 만들 때마다 Android App 막대 메뉴가 사라집니다.

예컨대 코드 :

Intent intent = new Intent(getApplicationContext(), NextActivity.class; 
startActivity(intent); 

앱 표시 줄 메뉴 항목이 사라 졌습니까? :(

사람이 말해 줄 수

그래서 새로운 활동을 열 때마다 무엇을, 같은 응용 프로그램 바 메뉴는 항상 존재 수정 됨

:

**activity.xml** 



       <?xml version="1.0" encoding="utf-8"?> 
      <android.support.v4.widget.DrawerLayout 
       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/drawer_layout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:fitsSystemWindows="true" 
       tools:openDrawer="start"> 

       <include 
        layout="@layout/app_bar_main" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 

       <android.support.design.widget.NavigationView 
        android:id="@+id/nav_view" 
        android:layout_width="wrap_content" 
        android:layout_height="400dp" 
        android:layout_gravity="start" 
        android:fitsSystemWindows="true" 
        app:headerLayout="@layout/nav_header_main" 
        app:menu="@menu/activity_main_drawer" /> 

     </android.support.v4.widget.DrawerLayout> 


**activity_intention.xml:** 
    <?xml version="1.0" encoding="utf-8"?> 
    <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/drawer_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true" 
     tools:openDrawer="start"> 




*I'll also include the app_bar_main.xml* 




     <?xml version="1.0" encoding="utf-8"?> 
     <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="com.example.beminix.dcar.MainActivity"> 

      <android.support.design.widget.AppBarLayout 
       android:layout_height="wrap_content" 
       android:layout_width="match_parent" 
       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" /> 

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

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



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

The toolbar that I want to keep using The 3 menu icons are gone so as the title

+0

NextActivity에 대한 XML을 게시 할 수 있습니까? 뿐만 아니라 응용 막대가 표시되는 MainActivity에 대한 xml –

+0

@BlancheNeedsHelp NextActivity보기의 내용을 확인하여 테마를 확인하고 질문을 게시 할 때 관련 물건을 모두 게시하십시오. –

+2

옵션 메뉴를 설정해야합니다. 모든 활동 –

답변

0

이것은 다른 해결책이지만 내 프로젝트에서 현재 작업하고 있습니다. 활동 및 클릭 조각에서 다른 조각을 사용하여 두 조각을 사용하면 1 개의 메뉴 막대가 생기고 활동을 원할 경우에는 b 작업을해야합니다. 모든 액티비티

+0

도구 모음을 사용하여 모든 활동을 복사하십시오. –

+0

조각에 대해 알고 있지만 검색 활동과 그 활동 내에 검색보기 및 목록보기를 넣어야하기 때문에 새로운 활동을 만들어야합니다. 내 도구 모음에는 아이콘이 있으며 그 방법은 우리 상태 다이어그램이 수행해야하는 방식이므로 따라야합니다. – AnyHelpPls

+0

조각에서 검색보기를 사용할 수 없다는 게시물의 답변을 읽었습니다. :( – AnyHelpPls