2017-07-28 70 views
-1

activity_main.xml中应用海拔不工作

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    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" 
    android:background="@color/tan_background" 
    android:orientation="vertical" 
    tools:context="com.example.android.miwok.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme" 
     app:elevation="0dp"> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/sliding_tabs" 
      style="@style/MyCustomTabLayout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

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

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</LinearLayout> 

App Screenshot

我创建从Udacity课程这个程序。我想知道如何从AppBar中删除高程。我尝试过多种方式,但不起作用。我预览选项卡阴影是不可见的,我想在我的应用程序。但在仿真器中,它又出现了。我试着改变styles.xml并使用android:elevation和app:elevation。

+0

设置'海拔= 0'的标签布局太 –

+0

的可能的复制[安卓:我无法将工具栏上删除海拔/阴影](https://stackoverflow.com/questions/ 31247041/android-i-can-remove-elevation-shadow-on-my-toolbar) –

回答

0

试试这个

getSupportActionBar().setElevation(0); 
+0

他不需要首先将工具栏设置为操作栏,以便能够执行此操作吗? –

+0

谢谢@Nilesh它工作:) –

+0

@CharchitGarg最受欢迎 –