java-如何在cardview侧面设置颜色

java-如何在cardview侧面设置颜色,第1张

概述我试图了解像这样在CardView侧面设置颜色的最佳方法是什么我的cardview看起来像这样:<?xmlversion="1.0"encoding="utf-8"?><androidx.cardview.widget.CardViewxmlns:android="http://schemas.android.com/apkes/android"xmlns:app="http://schemas.

我试图了解像这样在CardVIEw侧面设置颜色的最佳方法是什么

我的cardvIEw看起来像这样:

<?xml version="1.0" enCoding="utf-8"?><androIDx.cardvIEw.Widget.CardVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:app="http://schemas.androID.com/apk/res-auto"xmlns:card_vIEw="http://schemas.androID.com/tools"androID:ID="@+ID/cardVIEwWe"androID:layout_wIDth="match_parent"androID:layout_height="wrap_content"androID:layout_marginleft="4dp"androID:layout_margintop="4dp"androID:layout_marginRight="4dp"androID:layout_marginBottom="4dp"androID:foreground="?attr/selectableItemBackground"androID:Transitionname="cardTransition"app:cardBackgroundcolor="@drawable/selector"app:cardElevation="2dp"card_vIEw:cardCornerRadius="8dp">  <androIDx.constraintlayout.Widget.ConstraintLayout    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"> ..... .....   </androIDx.constraintlayout.Widget.ConstraintLayout></androIDx.cardvIEw.Widget.CardVIEw>

解决方法:

试试这个

<?xml version="1.0" enCoding="utf-8"?><androID.support.v7.Widget.CardVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:app="http://schemas.androID.com/apk/res-auto"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:orIEntation="vertical"    app:cardCornerRadius="10dp"    app:cardElevation="2dp"    app:cardUseCompatpadding="true">    <linearLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:background="@androID:color/white"        androID:orIEntation="horizontal">        <VIEw            androID:layout_wIDth="5dp"            androID:layout_height="match_parent"            androID:background="@color/colorAccent" />        <linearLayout            androID:layout_wIDth="0dp"            androID:layout_height="wrap_content"            androID:layout_weight="1"            androID:orIEntation="vertical"            androID:padding="10dp">            <TextVIEw                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="Nilesh Rathod" />            <TextVIEw                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="Nilesh Rathod" />            <TextVIEw                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:text="Nilesh Rathod" />        </linearLayout>    </linearLayout></androID.support.v7.Widget.CardVIEw>

输出值

总结

以上是内存溢出为你收集整理的java-如何在cardview侧面设置颜色全部内容,希望文章能够帮你解决java-如何在cardview侧面设置颜色所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1092319.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存