rni*_*ski 3 android material android-layout
我有一个操作栏和标签栏.我删除了动作栏下面的阴影
<item name="android:windowContentOverlay">@null</item>
Run Code Online (Sandbox Code Playgroud)
虽然,我想在标签栏下添加阴影.我正在使用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" />
Run Code Online (Sandbox Code Playgroud)
怎么做?
yun*_*nyu 21
jmols回答的结果与Google应用程序(例如Play报亭)使用的阴影不同.这是我的方法,它使阴影看起来与Play报亭完全相同:
创建一个名为drawable的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="#33000000"
android:angle="90">
</gradient>
</shape>
Run Code Online (Sandbox Code Playgroud)
然后,将该阴影设置为您的内容布局,例如:
<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>
Run Code Online (Sandbox Code Playgroud)
放置在工具栏/操作栏下方,这与Play报亭和Play商店中的实现完全相同.
归档时间: |
|
查看次数: |
10074 次 |
最近记录: |