工具栏和选项卡之间的线 [英] Line coming between toolbar and Tabs

查看:27
本文介绍了工具栏和选项卡之间的线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何去除工具栏和tablayout之间的深线,我在google上搜索了有人说,给工具栏和tablayout添加一些高程,我做了但是没有用,在从工具栏和tablyout中删除高程之后,它是也不工作.请帮帮我:

tablayout_xml:

解决方案

我遇到了同样的问题,我使用的是 android:elevation="0dp" 但它没有用.在 xml 中的 AppBarLayout 中,设置 app:elevation="0dp" 而不是 android:elevation="0dp".

How to remove the deep line between the toolbar and tablayout, I searched on the google someone said , add some elevation to the toolbar and tablayout ,I did but it not worked , after removing the elevation from the toolbar and tablyout ,it's also not working.Please help me out :

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 had the same problem, i was using android:elevation="0dp" but it didn't work. To the AppBarLayout in xml, set app:elevation="0dp" instead of android:elevation="0dp".

这篇关于工具栏和选项卡之间的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆