我想要做的是为LinearLayout定义一个通用的背景,该背景在应用程序的许多Activity中频繁使用。这个特定的布局是一个标题,显示在每个活动的顶部。
我想创建一个drawable,使其填充LinearLayout并具有渐变色,并在渐变下方显示一条水平线。是否有人知道是否可能实现这一点,或者我必须只能使用嵌套布局来完成这种事情。
我的尝试是 drawable xml:
我想创建一个drawable,使其填充LinearLayout并具有渐变色,并在渐变下方显示一条水平线。是否有人知道是否可能实现这一点,或者我必须只能使用嵌套布局来完成这种事情。
我的尝试是 drawable xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#AA000000" android:endColor="#AA333333"
android:angle="270" />
</shape>
</item>
<item>
<shape android:shape="line">
<stroke android:width="3dp" android:color="#FFFFFFFF"
android:dashWidth="1dp" android:dashGap="2dp" />
<size android:height="5dp" />
</shape>
</item>
</selector>