2016-08-29 2 views
2

Comment faire pour supprimer la ligne profonde entre la barre d'outils et tablayout, j'ai cherché sur le google quelqu'un a dit, ajouter une certaine élévation à la barre d'outils et tablayout, je l'ai fait mais ça ne fonctionne pas, après avoir enlevé l'élévation de la barre d'outils et tablyout, c'est pas non plus working.Please me aider:Ligne entre la barre d'outils et les onglets

tablayout_xml:

<RelativeLayout 
    android:id="@+id/main_layout" 
    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.support.design.widget.TabLayout 
     android:id="@+id/tab_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/toolbar" 
     app:tabGravity="fill" 
     android:elevation="2dp" 
     app:tabMode="fixed" 

     app:font="Nexa Bold.otf" 
     android:minHeight="?attr/actionBarSize" 
     android:background="@color/appbarColor" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="match_parent" 
     android:layout_height="fill_parent" 

     android:layout_below="@id/tab_layout"/> 

</RelativeLayout> 

activity_toolbar:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.CoordinatorLayout 
     android:id="@+id/container_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

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

       <android.support.v7.widget.Toolbar 
        android:id="@+id/toolbar" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        android:background="@color/appbarColor" 
        android:elevation="2dp" 
        app:layout_scrollFlags="scroll|enterAlways" 
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" > 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textSize="@dimen/_15sdp" 
         android:textStyle="bold" 
         android:textColor="#fff" 
         android:layout_gravity="center" 
         android:id="@+id/toolbar_title" /> 
        <LinearLayout 
         android:id="@+id/clearllBtn" 
         android:layout_width="50dp" 
         android:layout_height="50dp" 
         android:layout_marginRight="5dp" 
         android:layout_gravity="right" 
         android:visibility="gone" 
         android:background="@drawable/toolbar_ripple" 
         android:gravity="center_vertical|center_horizontal"> 
         <TextView 

          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:textSize="@dimen/appbar_txt_size" 
          android:text="Clear" 
          android:textColor="@color/white" 

          android:gravity="center" 
          android:textStyle="bold" 
          android:id="@+id/clear_btn"/> 


        </LinearLayout> 


       </android.support.v7.widget.Toolbar> 

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




      <FrameLayout 
       android:layout_below="@+id/app_bar" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:focusable="false" 
       android:focusableInTouchMode="false" 
       android:background="@color/faintwhite" 
       android:id="@+id/frame_container"> 

      </FrameLayout> 





     </RelativeLayout> 


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


    <!-- Navigation Drawer--> 
    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recyclerView" 
     android:layout_width="300dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="left" 
     android:background="@color/white" 
     > 

    </android.support.v7.widget.RecyclerView> 

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

I don't want deep Line Between the toolbar and tablayout

+0

Définissez 'android: elevation =" 0dp "' pour la barre d'outils. – Piyush

+4

'#app: elevation =" "' –

Répondre

3

J'ai eu le même problème, j'utilisais android:elevation="0dp" mais cela ne fonctionnait pas. Pour le AppBarLayout en XML, définissez app:elevation="0dp" au lieu de android:elevation="0dp".

+0

merci cela a fonctionné parfaitement :) –

+0

Yup ... Great :) –

+1

Accepter cette réponse –

0

Supprimez vos mises en page relatives et placez TabLayout dans la barre d'outils, sous la barre d'outils, et supprimez toutes les personnes que vous souhaitez ajouter. C'est la bonne façon de le faire. Si cela ne fonctionne pas pour vous, je serai heureux de vous aider.

2

J'ai eu même problème et utilisé android:elevation="0dp" et app:elevation="0dp" mais le problème ne solved.Then j'ai changé l'élévation de la barre d'outils dynamically.By utilisant ce

getSupportActionBar().setElevation(0); 

et cela a fonctionné pour moi.

0

Accédez à la barre d'outils et définissez app:elevation="0dp" uniquement dans la barre d'outils et la disposition de la barre d'applications. Tout ira bien.