gpt4 book ai didi

android - 如何在 Lollipop 之前的设备中使用 background、backgroundTint 和 backgroundTintMode

转载 作者:行者123 更新时间:2023-11-30 00:30:27 24 4
gpt4 key购买 nike

我正在使用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_sign_up"
android:backgroundTint="@color/colorTranslucent"
android:backgroundTintMode="multiply"
android:orientation="vertical"
android:weightSum="10">

<color name="colorTranslucent">#dd282d50</color>

但这适用于 21 及以上。我想要它在 API 17 和 19 中。我正在扩展 Activity。

最佳答案

为了绕过 api 21 及更高版本的背景色,我只是将 View 作为我布局中的第一项。如此纯xml。在这个 View 中,我将使用透明颜色来处理背景,而不是色调。例如

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.HomeFragment"
android:id="@+id/frameLayout"
android:background="@drawable/planeWing">

<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/semiTransparentDarkBlue">
</View>

<TextView
android:id="@+id/greeting_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="@string/greeting_hello"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintVertical_bias="0.0" />

</android.support.constraint.ConstraintLayout>

我也不确定你使用的乘法。

关于android - 如何在 Lollipop 之前的设备中使用 background、backgroundTint 和 backgroundTintMode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44498691/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com