android - 如何删除 ActionBar 和屏幕其余部分之间的分隔线?
问题描述
我想删除 sc 中显示的分隔符。 看绿色箭头
(我在 viewpager 和我的框架中加载了 5 个片段,当我触摸选项卡时,片段会发生变化)
这是我用于此活动的 xml 代码。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="ir.myinsta.myinstaapp.MainActivity">
<android.support.v7.widget.CardView
android:id="@+id/header_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height">
<RelativeLayout
android:id="@+id/actionbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/my_gradiant">
<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
style="@style/MyDrawerArrowToggle"
android:layout_width="@dimen/toolbar_height"
android:layout_height="@dimen/toolbar_height"
android:layout_alignParentRight="true">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="@+id/helpImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="@+id/main_toolbar"
android:clickable="true"
android:src="@mipmap/ic_launcher" />
<LinearLayout
android:id="@+id/gemLayout"
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:clickable="true"
android:gravity="left"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dp"
android:src="@drawable/diamond_white" />
<TextView
android:id="@+id/gemCountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:layout_gravity="center_vertical"
android:textColor="@color/white" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:elevation="5dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp"
android:background="@color/white"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="#00000000"
app:tabIndicatorHeight="0dp" />
<android.support.v4.view.ViewPager
android:id="@+id/myViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/tab_layout"
android:layout_below="@id/header_layout">
</android.support.v4.view.ViewPager>
<FrameLayout
android:id="@+id/fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header_layout"></FrameLayout>
<RelativeLayout
android:id="@+id/centerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:padding="150dp" />
</RelativeLayout>
我不知道这是分隔线还是高程。请帮助我。使用样式?或者是什么?
解决方案
尝试app:elevation="0dp"
在您的工具栏中添加。
像这样 :-
<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
style="@style/MyDrawerArrowToggle"
app:elevation="0dp"
android:layout_width="@dimen/toolbar_height"
android:layout_height="@dimen/toolbar_height"
android:layout_alignParentRight="true">
</android.support.v7.widget.Toolbar>
或者您可以使用:-
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp">
</android.support.design.widget.AppBarLayout>
推荐阅读
- c++ - 如何进行自动阵列检测?
- python - 如何使用 keras-self-attention 包可视化注意力 LSTM?
- php - Angular 8 到 PHP 后端
- java - 将变量作为方法参数传递
- firebase - 不存在文档的 Firestore 事务锁定行为
- angular - Angular 8:路由双嵌套命名路由器出口
- ruby-on-rails - 在多个表的属性中创建搜索
- python-3.x - 有没有更好的方法来做到这一点我有一个工作代码,但我认为它可以优化?
- javascript - 在 promise 函数中等待
- angular - 更改检测器参考不适用于 Angular Material 对话框