tablayout+ ViewPager -ViewPager正在剪断Tablayout高程
我有底部TableAut
,该已连接到上面的ViewPager
。 TableOut
具有顶部高程
,应在ViewPager前可见(想要在每个viewPager
页面的底部具有凉爽的高程淡出效果) 。应该将同样的内容应用于viewPager
中的任何内容。问题是,这个高程是某种程度上被删除的,我根本看不到它。 ViewPager
页面也打开底部纸,因此我想具有相同的效果,即BottomSheet
是从Tablayout
的背后窥视的。
布局:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/paper_transparent"
android:clipToPadding="false"
android:clipChildren="false">
<components.NonSwipableViewPager
android:id="@+id/vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/tabLayout"
android:clipChildren="false"
android:clipToPadding="false"
android:overScrollMode="never">
</components.NonSwipableViewPager>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:clipToPadding="false"
android:clipChildren="false"
style="@style/main_tab">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/main_tab_layout" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/main_tab_layout"/>
</com.google.android.material.tabs.TabLayout>
</RelativeLayout>
样式:
<style name="main_tab">
<item name="android:elevation">@dimen/padding_large</item>
<item name="android:paddingTop">@dimen/padding_small</item>
<item name="android:paddingBottom">@dimen/padding_medium</item>
<item name="android:background">@color/paper_transparent</item>
<item name="tabMaxWidth">0dp</item>
<item name="tabGravity">fill</item>
<item name="tabMode">fixed</item>
<item name="tabIconTint">@color/tab_icon_tint</item>
<item name="tabIndicator">@drawable/tab_indicator</item>
<item name="tabIndicatorColor">@color/tab_color</item>
<item name="tabIndicatorGravity">center</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabIndicatorHeight">50dp</item>
<item name="tabRippleColor">@null</item>
</style>
I have bottom TabLayout
which is connected to ViewPager
above. TabLayout
has top elevation
which should be visible in front of ViewPager (want to have cool elevation fade out effect at the bottom of each ViewPager
page). Same should be applied to any content in that ViewPager
. Problem is, that this elevation is somehow clipped and I cant see it in my app at all. ViewPager
pages are also opening bottom sheets, so I want to have same effect that BottomSheet
is peeking from behind of TabLayout
.
Layout:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/paper_transparent"
android:clipToPadding="false"
android:clipChildren="false">
<components.NonSwipableViewPager
android:id="@+id/vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/tabLayout"
android:clipChildren="false"
android:clipToPadding="false"
android:overScrollMode="never">
</components.NonSwipableViewPager>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:clipToPadding="false"
android:clipChildren="false"
style="@style/main_tab">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/main_tab_layout" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout="@layout/main_tab_layout"/>
</com.google.android.material.tabs.TabLayout>
</RelativeLayout>
Style:
<style name="main_tab">
<item name="android:elevation">@dimen/padding_large</item>
<item name="android:paddingTop">@dimen/padding_small</item>
<item name="android:paddingBottom">@dimen/padding_medium</item>
<item name="android:background">@color/paper_transparent</item>
<item name="tabMaxWidth">0dp</item>
<item name="tabGravity">fill</item>
<item name="tabMode">fixed</item>
<item name="tabIconTint">@color/tab_icon_tint</item>
<item name="tabIndicator">@drawable/tab_indicator</item>
<item name="tabIndicatorColor">@color/tab_color</item>
<item name="tabIndicatorGravity">center</item>
<item name="tabIndicatorFullWidth">false</item>
<item name="tabIndicatorHeight">50dp</item>
<item name="tabRippleColor">@null</item>
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论