如何删除LinearLayout阴影? [重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

我有以下布局:

enter image description here

XML code:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".Activities.OwnerProfileActivity">

    <LinearLayout
        android:id="@+id/linear_layout_profile_top"
        android:layout_width="0dp"
        android:layout_height="165dp"
        android:background="@color/colorPrimary"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <View
            android:layout_width="match_parent"
            android:layout_height="20dp" />

        <ImageView
            android:id="@+id/imageView_profile_picture"
            style="@style/ProfileImageStyle"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ic_user" />

        <TextView
            android:id="@+id/textView_user_name"
            style="@style/UserNameLabelStyle"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="TextView"
            android:textSize="18sp" />
    </LinearLayout>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/linear_layout_profile_top"
        app:tabSelectedTextColor="@color/colorPrimary">

        <android.support.design.widget.TabItem
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/about_label" />

        <android.support.design.widget.TabItem
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/businesses_label" />

        <android.support.design.widget.TabItem
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/coupons_label" />

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

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager_page"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toTopOf="@+id/lower_navigation"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tabLayout"
        app:layout_constraintVertical_bias="1.0" />

    <fragment
        android:id="@+id/lower_navigation"
        android:name="com.nprogramming.android.couponsapp.Fragments.LowerNavigationBarFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>

如何删除ActionBar和LinearLayout(红色块)之间的阴影?

提前致谢。

android android-actionbar android-linearlayout
1个回答
1
投票

将此代码添加到您的方法onCreate()of OwnerProfileActivity

if(getSupportActionBar() != null) { getSupportActionBar().setElevation(0); }

© www.soinside.com 2019 - 2024. All rights reserved.