DayLight主题中的颜色是什么?

问题描述 投票:0回答:1

我正在开发将CardViewRecyclerView结合使用的应用。

主题是AppCompat.DayLight。卡片主要是白色背景,recyclerview也是如此,但是比卡片背景要暗一些,这是默认值,来自DayNight主题,我相信。

但是,我不知道这些颜色的确切值或名称,因为我不得不在其他地方使用这些值。

有人可以用这些价值观帮助我吗?

android android-appcompat android-theme
1个回答
-1
投票

尝试此行

app:cardBackgroundColor="@color/yourColor"

在xml文件中,您可以添加它

<android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="@color/yourColor">
</android.support.v7.widget.CardView>

编辑

尝试下面的代码行

    <style name="CustomCardview1" parent="CardView">
          <item name="cardBackgroundColor">#F3921F</item>
          <item name="android:layout_width">match_parent</item>
          <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_margin">10dp</item>
     </style>

    <style name="CustomCardview2" parent="CardView">
          <item name="cardBackgroundColor">#F3931F</item>
          <item name="android:layout_width">match_parent</item>
          <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_margin">10dp</item>
     </style>

在需要卡片视图的布局中编写下面的代码行

 <android.support.v7.widget.CardView
      style="@style/CustomCardview">

我希望理解正确

© www.soinside.com 2019 - 2024. All rights reserved.