2016-12-15 6 views
1

私は友人からこのソースコードを入手しました。彼はその中にナビゲーションドロワーメニューを実装していますが、削除します。私は引き出しについてmain.javaからすべてを削除したが、私は私のアプリでこれを参照してください。Androidアプリからこのバーを削除するには?

The White Bar

私は名前の白いバーを意味します。ここで

は、レイアウトコードです:

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="#fff > 





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

    <RelativeLayout android:id="@+id/content_frame_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#ffffff" 
     android:layout_below="@+id/toolbar_app_bar_layout"> 




     <FrameLayout 
      android:id="@+id/content_frame" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 
     </FrameLayout> 

    </RelativeLayout> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/toolbar_app_bar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 

      android:gravity="center" 
      android:orientation="vertical" > 

      <include 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       layout="@layout/top_points_bar" /> 
     </LinearLayout> 
     <android.support.design.widget.TabLayout 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/sliding_tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/toolbar" 
      app:tabMode="scrollable" 
      app:paddingStart="16dp" 
      app:tabPaddingStart="16dp" 
      app:tabPaddingEnd="16dp" 
      app:tabMinWidth="96dp" 
      app:tabGravity="center" /> 

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

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 


</RelativeLayout> 

<android.support.design.widget.NavigationView 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/navigation_view" 

    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="start" 
    android:background="@color/md_brown_100" 
    app:menu="@menu/menu_drawer" 
    android:textColor="@color/okurwa" 
    android:visibility="gone" 
    app:theme="@style/MyTabStyle" 
    app:headerLayout="@layout/nav_drawer_header" 
    app:itemTextAppearance="@style/MyTabTextStyle" 
    android:clipToPadding="false"> 
    <include 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textColor="@color/md_white_1000" 
     android:visibility="gone" 
     layout="@layout/nav_drawer_header" 
     android:orientation="vertical" 

     /> 





    <TextView 
     android:id="@+id/nav_drawer_wallet_id" 
     android:layout_width="177dp" 
     android:layout_height="wrap_content" 
     android:textSize="15sp" 
     android:layout_marginTop="8dp" 
     android:layout_marginLeft="16dp" 
     android:layout_marginBottom="8dp"/> 

    <TextView 
     android:id="@+id/nav_drawer_total_credits" 
     android:layout_width="182dp" 
     android:layout_height="wrap_content" 
     android:textSize="16sp" 
     android:layout_marginTop="200dp" 
     android:layout_marginLeft="16dp" /> 

    <TextView 
     android:id="@+id/nav_drawer_username" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:textSize="22sp" 
     android:layout_marginTop="150dp"/> 



    <!--<FrameLayout--> 
     <!--android:layout_width="match_parent"--> 
     <!--android:layout_height="wrap_content"--> 
     <!--android:layout_gravity="bottom"--> 
     <!--android:background="@color/md_white_1000"--> 
     <!--android:elevation="4dp"--> 
     <!--android:layout_marginBottom="-96dp">--> 

     <!--<Button android:id="@+id/navigation_button_footer"--> 
      <!--android:layout_width="match_parent"--> 
      <!--android:layout_height="match_parent"--> 
      <!--android:text=""--> 
      <!--android:textSize="13sp"--> 
      <!--android:textColor="@color/md_grey_800"--> 
      <!--android:lines="3"--> 
      <!--android:gravity="center"--> 
      <!--style="@style/Widget.AppCompat.ActionButton"--> 
      <!--android:paddingTop="20dp"--> 
      <!--android:paddingLeft="20dp"--> 
      <!--android:paddingRight="20dp"--> 
      <!--android:paddingBottom="20dp"/>--> 

    <!--</FrameLayout>--> 

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

<RelativeLayout 
    android:id="@+id/lay_connection" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginTop="@dimen/actmain_margintop" 
    android:background="#3c3c3c" 
    android:visibility="gone" > 

    <TextView 
     android:id="@+id/text_error" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:gravity="center" 
     android:text="@string/error_no_internet" 
     android:textColor="@color/md_white_1000" 
     android:textSize="@dimen/twentyfive" /> 


    <RelativeLayout 
     android:id="@+id/lay_dialog" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:visibility="gone" > 

     <ProgressBar 
      android:id="@+id/progressBar1" 
      style="?android:attr/progressBarStyleLarge" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" /> 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/progressBar1" 
      android:layout_centerHorizontal="true" 
      android:text="@string/error_no_internet" 
      android:textColor="@color/md_white_1000" 
      android:textSize="@dimen/twentyfive" /> 
    </RelativeLayout> 
</RelativeLayout> 

し、ユーザーがそれをスライドさせますときにも、それは左のメニューを削除しますか? 私を助けてください!私はすべての解決策を試したと思います。

答えて

0

ここで説明するようにあなたのstyle.xmlファイルで"@style/Theme.AppCompat.Light.NoActionBar"を使用することができます。remove-android-app-title-bar

またはあなたがあなたの活動のonCreate()

getSupportActionBar().hide();

を追加することができます。

+0

それは、このバーにアプリ名を削除しますが、バーが –

+0

試し 'getSupportActionBarを()既存れる非表示()' – Kimmy

+0

'setDisplayShowTitleEnabled'。?本当に? OPは、「ツールバー」を削除し、タイトルを隠さないようにしたい!それに注意してください... – Mohsen

0

彼はナビゲーションドロワーメニューを実装していますが、 を削除します。私はあなたがNavigationDrawer実装のすべてを削除しようとしている場合は、その後、あなたはXMLレイアウトでDrawerLayoutNavigationDrawerコードを削除する必要があります引き出し

についてmain.javaからすべてを削除しました。ここで

が、これについてのドキュメントです:(まず、それらのすべてを削除し、それが働いている方法を学習し、実装を学ぶ)

https://developer.android.com/training/implementing-navigation/nav-drawer.html

だから、あなたはこれを削除する必要がありますが、あなたはしませんでした実際に何かについて言及しています。それについて(白い部分) - (私たちはToolbarと呼んでいます)、あなたがxmlにToolbarコードを見ることができないのでこれを削除しようとしている場合は、あなたのレイアウトの大きな変化。

上記の削除後、NavigationDrawerの一部であるNavigationViewを削除してください。

また、ユーザーがスライドすると左のメニューが削除されますか?

はい、はい。これらすべての後、あなたはどちらか、このファイルを削除する必要があります:

とにかく
@menu/menu_drawer 

、私は、私はあなたが加算された画像の上にこの名前で何かを見ることができなかったものTabLayoutについては何も言って、そうしませんでしたこの画像よりもレイアウトのプレビューを見る必要があります...

ただし、Toolbarを削除する場合は、AppBarLayoutのいずれかを変更または削除することができます。

CoordinatorLayoutのこの実装を見てください。それはあなたが新しいレイアウトを作成するのに役立ちます。

https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html

関連する問題