0
我想在tablayout後創建一個陰影,但它後我點擊另一個標籤或我向下滾動查看傳呼機下面消失。這是我向下滾動後發生的情況。Tablayout投影陰影消失後,我點擊Android上的另一個標籤棒棒糖
的陰影出現在第一加載後:
我向下滾動後,陰影消失:
我單擊另一個選項卡後,陰影也消失:
但是當我再次滾動並點擊回到它的第一個目的地後,陰影又出現了!
我已經走遍了SO,但我似乎可以找到答案。希望你們能幫助我。
我的代碼:
<?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:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_lane"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/lighter_purple_99"
android:elevation="4dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingTop="4dp">
<ImageView
android:id="@+id/img_lane_settings"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="right"
android:layout_marginRight="14dp"
android:src="@drawable/icn_settings" />
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
app:tabIndicatorColor="@color/white_100"
android:background="@color/lighter_purple_99"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:elevation="4dp"/>
<View
android:id="@+id/shadow_below_tabs2"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_below="@+id/tabs2"
android:background="@drawable/shadow"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tabs2"
android:keepScreenOn="true"
tools:context="TabActivity" />
</RelativeLayout>
提拉/ shadow.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#ff000000"
android:angle="90">
</gradient>
</shape>
我已經嘗試:
- AppBarLayout但它有在陰影背景,所以它看起來醜陋。
希望你能幫助我。提前致謝!