0

tablayout 후에 그림자를 만들려고하지만 다른 탭을 클릭하거나 그 아래의보기 호출기를 스크롤 한 직후 사라집니다. 아래로 스크롤 한 후 일어나는 일이 있습니다. 드롭 그림자가 처음 로딩 후 표시Android 태블릿에서 다른 탭을 클릭하면 Tablayout Drop Shadow가 사라집니다

: 나는 아래로 스크롤 한 후

drop shadow appear

는 그림자가 사라 :

drop shadow disappear

을 내가 다른 탭을 클릭하면 그림자를 뿐만 아니라 사라집니다 :

drop shadow disappear after i clicked another tab

그러나 다시 스크롤하여 첫 번째 대상으로 돌아 가면 그림자가 다시 나타납니다!

drop shadow appears again!

는 이미 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> 

이미 시도

<?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> 

드로어 블/shadow.xml :

- AppBarLayout하지만 그림자에 배경이있다가 보이는 있도록 추한.

희망을 보내 주시면 감사하겠습니다. 미리 감사드립니다!

답변

0

해결했습니다!

그림자 뷰를 뷰 페이지 아래에두기 만하면됩니다. 이 방법으로 그림자는 마지막에 표시되고 뷰 페이지 상단에 배치됩니다.

<?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"/> 

    <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="com.dojomadness.lolsumo.activities.LaneActivity" /> 

    <View 
     android:id="@+id/shadow_view" 
     android:layout_width="match_parent" 
     android:layout_height="4dp" 
     android:layout_below="@id/tabs2" 
     android:background="@drawable/shadow" 
     /> 
</RelativeLayout> 
관련 문제