include 문을 사용하여 다른 활동에서 menu.xml 파일을 만들 수 있습니까? 두 번째 활동 XML 파일에서이 코드 줄을 시도했습니다. 앱이 다운됩니다. 내 구문이 정확합니까?include 문을 사용하여 menu.xml을 다시 사용합니다.
<include layout="@menu/menu_main"/>
그래서 메뉴가 필요할 때마다 팽창해야합니까?
include 문을 사용하여 다른 활동에서 menu.xml 파일을 만들 수 있습니까? 두 번째 활동 XML 파일에서이 코드 줄을 시도했습니다. 앱이 다운됩니다. 내 구문이 정확합니까?include 문을 사용하여 menu.xml을 다시 사용합니다.
<include layout="@menu/menu_main"/>
그래서 메뉴가 필요할 때마다 팽창해야합니까?
나는이 글에 따라 include 문을 사용할 수없는 다양한 구문 문을 포함하여 이것을 시도했다. 그렇기 때문에 필요할 때마다 메뉴를 팽창시켜야한다. HERE
예, 가능합니다. 예를 들어, 다른 활동에서 내비게이션 서랍을 복제해야하는 경우 다음과 같습니다.
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
</FrameLayout>
<!-- The navigation drawer -->
<include layout="@layout/nav_drawer"/>
</android.support.v4.widget.DrawerLayout>
이 줄이 포함 된 활동 레이아웃 xml을 표시 할 수 있습니까? – iguarna