Così ho un layout che è simile al seguente:Android: Elevation non rispettata in tutto FragmentTransactions
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="?attr/colorPrimary"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"/>
<FrameLayout
android:id="@+id/content"
android:layout_below="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
Questo forma il mio file di layout di base per la mia attività e poi scambiare il FrameLayout per vari frammenti. Uno di questi frammento ha un layout simile a questo:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:elevation="4dp"
android:layout_height="wrap_content"/>
<android.support.v4.view.ViewPager
android:id="@+id/profileViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/sliding_tabs"
android:background="@android:color/white"/>
<FloatingActionButton
android:id="@+id/floatingButton"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"/>
</RelativeLayout>
mi aspetterei che, come ho impostato l'elevazione sia della barra degli strumenti e la SlidingTabLayout di essere 4DP, che la barra degli strumenti non avrebbe gettato un'ombra sulle linguette, comunque lo fa:
Idealmente io non vorrei essere l'impostazione della elevazione della barra degli strumenti nel codice - qualcuno sa se c'è un modo per evitare che la barra degli strumenti che proietta un'ombra? Avrei dato per scontato che, dal momento che entrambe le viste sono a 4dp di elevazione, anche se non sono nello stesso layout, nessuna ombra verrebbe proiettata.
Grazie per l'aiuto.
Ecco il ticket per il bug di Android: https://code.google.com/p/android/issues/detail?id=82041 – Stanislav