android– 在TabBar下面添加阴影 –Material Design

android– 在TabBar下面添加阴影 –Material Design,第1张

概述我有一个 *** 作栏和标签栏.我删除了动作栏下面的阴影<itemname="android:windowContentOverlay">@null</item>虽然,我想在标签栏下添加阴影.我正在使用SlidingTabLayout.我的标签TextView:<TextViewxmlns:android="http://schemas.android.com/apkes/android"android:id="

我有一个 *** 作栏和标签栏.我删除了动作栏下面的阴影

<item name="androID:windowContentOverlay">@null</item>

虽然,我想在标签栏下添加阴影.我正在使用SlIDingTabLayout.我的标签TextVIEw:

<TextVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:ID="@+ID/tabText"androID:layout_wIDth="wrap_content"androID:layout_height="@dimen/actionbar_height"androID:textcolor="@color/tab_color"androID:gravity="center"androID:textAllCaps="true"androID:singleline="true" />

怎么做?

@R_404_6120@:

jmols回答的结果与Google应用(例如Play报亭)使用的阴影不同.这是我的方法,它使阴影看起来与Play报亭完全相同:

创建一个名为shadow.xml的drawable:

<?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="#33000000"        androID:angle="90">    </gradIEnt></shape>

然后,将该阴影设置为您的内容布局,例如:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent">    <!-- Your vIEws here -->    <VIEw        androID:layout_wIDth="match_parent"        androID:layout_height="8dp"        androID:background="@drawable/shadow" /></relativeLayout>

放置在工具栏/ *** 作栏下方,这与Play报亭和Play商店中的实现完全相同.

总结

以上是内存溢出为你收集整理的android – 在TabBar下面添加阴影 – Material Design全部内容,希望文章能够帮你解决android – 在TabBar下面添加阴影 – Material Design所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1120350.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存