【发布时间】:2021-03-16 21:40:36
【问题描述】:
大家好 我需要帮助来解决形状、渐变的问题。我使用 主题 与父 ↓
<style name="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge" />
<style name="Theme.Movie42" parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
我有一个内部有渐变的形状↓
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="@color/center_of_shape"
android:centerX="0.6"
android:endColor="@color/end_of_shape"
android:startColor="@color/start_of_shape"
android:type="linear" />
</shape>
</item>
我用它在 imageView 上制作内阴影↓
imageView.background =
ContextCompat.getDrawable(application.applicationContext, itemMovieData.drawable)
imageView.setImageDrawable(
ContextCompat.getDrawable(
application.applicationContext,
R.drawable.shape
)
)
当我在 Android 11(emulator)上运行应用程序时,一切看起来都不错 但是当它在带有 Android 6 或 7 的真实设备上运行时(可能是其他版本) “inner shadow”是白色的,其实我不需要↓
如何解决这个问题?让阴影“再次伟大”,我的意思是在 api 23/24↑
上让它变暗【问题讨论】:
标签: java android xml android-layout kotlin