【问题标题】:Remove Border Around AppBarLayout移除 AppBarLayout 周围的边框
【发布时间】:2018-07-02 02:56:25
【问题描述】:

我有一个如下所示的片段:

在屏幕底部相邻的粉红点和灰点的正上方(底部导航栏正上方),有一条水平灰线。

无论如何我可以删除它吗?

片段有以下布局文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".home.tutorial.TutorialFragment">



<android.support.v4.view.ViewPager
    android:id="@+id/tutorialViewPager"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toTopOf="@+id/appBar"
    android:background="@android:color/white"/>

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    app:layout_constraintTop_toBottomOf="@id/tutorialViewPager"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent">

    <me.relex.circleindicator.CircleIndicator
        android:id="@+id/circleIndicator"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        app:ci_drawable="@drawable/tab_indicator_selected"
        app:ci_drawable_unselected="@drawable/tab_indicator_default"
        app:ci_height="6dp"
        app:ci_width="6dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>


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

</android.support.constraint.ConstraintLayout>

我看了这个帖子:Remove ActionBar Border

但考虑到我不想从操作栏中删除边框,我认为它不适用。

【问题讨论】:

    标签: android android-xml android-appbarlayout


    【解决方案1】:

    在您的AppBarLayout 中设置app:elevation="0dp",如下所示:

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        app:elevation="0dp"                          <-- Add this line
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white"
        app:layout_constraintTop_toBottomOf="@id/tutorialViewPager"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent">
    

    【讨论】:

    • 请注意,它必须是“app:elevation”,而不是 Android Studio 中自动完成提供给我的“android:elevation”!
    【解决方案2】:

    也许它不是边框,而只是 AppBarLayout 下方的阴影。 您可以使用 app:elevation="0dp" 将其删除

    来源:remove shadow below AppBarLayout widget android

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-12
      • 1970-01-01
      相关资源
      最近更新 更多