Android CardView使用问题记录
来源:互联网 发布:软件报价怎么描述 编辑:程序博客网 时间:2024/05/24 05:37
问题一:明明在cardview中设置了圆角,为啥xml视图上面还是直角,最开始用cardview时候会有这东西设置无效的错觉,这个问题直接运行到真机上面看就可以了。
问题二:明明我给carcview设置了背景色,为啥展示是白色的,而且运行到真机上面也是白色的。 Carview设置背景颜色有其自己的属性:app:cardBackgroundColor=”#FE5C93”。
问题三:明明我给carcview设置了elevation属性
为啥当下面view也设置elevation的时候,上面的效果消失了? 解决:把两个view同时设置为cardview,那么两个view为同以层次,要么给两个view中间设置点间距,让阴影展示出来,要么把层次划分清楚。下面是代码:
<android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="0dp" app:layout_heightPercent="30%w" app:cardCornerRadius="0dp" android:elevation="@dimen/carview_elevation"> <com.zhy.android.percent.support.PercentLinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="0dp" app:layout_heightPercent="15%w" app:cardCornerRadius="0dp" android:elevation="@dimen/carview_elevation"> <com.zhy.android.percent.support.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/main_top_red" app:layout_textSizePercent="35%" android:textColor="@color/white" android:text="目的地" android:gravity="center"/> <ImageView android:layout_width="0dp" app:layout_widthPercent="40%h" android:layout_height="match_parent" android:src="@mipmap/search_white" android:layout_alignParentRight="true" android:layout_centerVertical="true" app:layout_marginRightPercent="5%w"/> </com.zhy.android.percent.support.PercentRelativeLayout> </android.support.v7.widget.CardView> <com.zhy.android.percent.support.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="@color/black" app:layout_textSizePercent="25%" android:text="美国" android:gravity="center_vertical" app:layout_marginLeftPercent="5%w" android:background="@color/white"/> </com.zhy.android.percent.support.PercentRelativeLayout> </com.zhy.android.percent.support.PercentLinearLayout> </android.support.v7.widget.CardView>
效果:
推荐下本人的微信公众号,本博客及其他方面的消息会定期同步到公众号上面!
0 0
- Android CardView使用问题记录
- Android CardView使用和导入出错问题
- Android开发--CardView使用
- Android开发--CardView使用
- Android CardView使用详解
- Android CardView使用详解
- Android CardView的使用
- Android CardView 的使用
- Android开发--CardView使用
- Android开发--CardView使用
- Android开发--CardView使用
- Android CardView的使用
- android:CardView使用详解
- Android开发--CardView使用
- Android CardView使用
- Android CardView 的使用
- Android中CardView使用
- #android#android studio 使用cardview
- elasticsearch集群安装
- mybatis中的@Param
- IOS系统基础
- 无线路由器信道干扰事件
- v-for循环 重复数据无法添加问题
- Android CardView使用问题记录
- PIL与matplotlib的图形显示
- Android 相关七种 CPU 架构适配
- Java 中extends与implements使用方法
- OpenWRT基础
- 某企业广域网BGP拓扑图
- 7065233排队
- HTTP协议
- BZOJ 1444: [Jsoi2009]有趣的游戏 AC自动机加矩阵快速幂