gpt4 book ai didi

安卓 : Cardview Background is turning to black on 4. 1.2

转载 作者:可可西里 更新时间:2023-11-01 18:49:35 29 4
gpt4 key购买 nike

我正在使用 google cardView 支持库来实现我的卡片功能。它适用于 kitkat 和版本更新,但卡片的背景设置为黑色,并且填充/边距不适用于设备 4.1.2。

<android.support.v7.widget.CardView
android:id="@+id/all_goals_card_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:padding="10dp"
app:cardCornerRadius="4dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardBackgroundColor="@android:color/white"
>
</android.support.v7.widget.CardView>

最佳答案

好吧,我只是偶然发现了同样的问题,我发现一些设备有一些“特殊的”非常轻的灯光主题默认值 咳咳 三星 咳咳 我会回答这个有点老的问题。

这里的问题是您很可能使用了错误的 context 来夸大您的布局。我认为您正在使用 application-context 来这样做。 Application-Context 不应用您定义的主题。

This (inflating with the application-context) is legal, but inflation will be done with the default theme for the system on which you are running, not what’s defined in your application.*

例如,如果您这样做:

LayoutInflater.from(context).inflate(R.layout.menu_rental_list_item, parent, false);

此处的context 应该是Activity-Fragment Context - NOT the application-上下文。

请仔细检查。

*) 啊,你想阅读更多关于上下文的信息吗?请继续阅读here .

关于安卓 : Cardview Background is turning to black on 4. 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35923377/

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