2014-02-28 2 views
0

내 앱의 탐색에 대한 조언/조언 등을 찾고 있습니다. 그래서 구현하는 방법을 이해하는 데 문제가 있어요이 레이아웃의 주요 부분은 가장 왼쪽 탐색 창 버튼의 자녀입니다Android 네비게이션 다루기

Layout Diagram

: 다음은 내 모든 화면의 레이아웃과 그들 사이의 흐름입니다. 버튼 아래의 기본 화면은 버튼이있는 또 다른 화면이며, Main의 버튼을 클릭하면 마법사가 화면 세트와 같은 모습으로 이동합니다. 각 단계에서 이전 화면으로 돌아가거나, 다음 단계로 넘어갈 수 있으며, 서랍 단추를 클릭하면 다시 메인 화면으로 돌아갑니다.

내가 의심하는 바는 이것이 안드로이드에 대해 거의 완전히 새로운 사람으로부터 온다. 메인을위한 하나의 활동과 각 단계마다 단편 세트를 사용한 하나의 활동이 필요하다는 것인가? 모든 조언이 유용합니다. 이 같은

답변

0

사용하십시오 DrawerLayout 및 조각 :

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <fragment 
     android:id="@+id/mainFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:name="MainFragment" /> 

</RelativeLayout> 


<!-- The navigation drawer --> 
<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="200dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:background="#FF232323" 
    android:layout_marginTop="64dp" 
    > 
    <fragment 
     android:id="@+id/navigation" 
     android:name="NavigationFragment" 
     android:layout_height="match_parent" 
     android:layout_width="wrap_content" /> 

</FrameLayout> 

+0

좋아! 그리고 개별 단계 화면에 대한 기본 정보는 어떻게됩니까? 이러한 모든 단계 화면이 하나의 활동으로 여러 개의 조각으로 분리되어야합니까? – DeveryDay

+0

[Go this this] (http://developer.android.com/training/implementing-navigation/nav-drawer.html). 문서의 샘플을 사용한 좋은 설명입니다. – whizzle