Create Cards


  CardView extends the FrameLayout class and lets you show information inside cards that have a consistent look across the platform. CardView widgets can have shadows and rounded corners.

  To create a card with a shadow, use the card_view:cardElevationattribute. CardView uses real elevation and dynamic shadows on Android 5.0 (API level 21) and above and falls back to a programmatic shadow implementation on earlier versions. For more information, see Maintaining Compatibility.

Use these properties to customize the appearance of the CardViewwidget:

  • To set the corner radius in your layouts, use thecard_view:cardCornerRadius attribute.
  • To set the corner radius in your code, use theCardView.setRadius method.
  • To set the background color of a card, use the card_view:cardBackgroundColor attribute.

          Figure 3. Card examples.

The following code example shows you how to include a CardView widget in your layout:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:card_view="http://schemas.android.com/apk/res-auto"
     ... >
     <!-- A CardView that contains a TextView -->
     <android.support.v7.widget.CardView
         xmlns:card_view="http://schemas.android.com/apk/res-auto"
         android:id="@+id/card_view"
         android:layout_gravity="center"
         android:layout_width="200dp"
         android:layout_height="200dp"
         card_view:cardCornerRadius="4dp">

         <TextView
             android:id="@+id/info_text"
             android:layout_width="match_parent"
             android:layout_height="match_parent" />
     </android.support.v7.widget.CardView>
 </LinearLayout>

For more information, see the API reference for CardView.

CardView官方教程的更多相关文章

  1. Unity性能优化(3)-官方教程Optimizing garbage collection in Unity games翻译

    本文是Unity官方教程,性能优化系列的第三篇<Optimizing garbage collection in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...

  2. Unity性能优化(4)-官方教程Optimizing graphics rendering in Unity games翻译

    本文是Unity官方教程,性能优化系列的第四篇<Optimizing graphics rendering in Unity games>的翻译. 相关文章: Unity性能优化(1)-官 ...

  3. Unity性能优化(2)-官方教程Diagnosing performance problems using the Profiler window翻译

    本文是Unity官方教程,性能优化系列的第二篇<Diagnosing performance problems using the Profiler window>的简单翻译. 相关文章: ...

  4. Unity性能优化(1)-官方教程The Profiler window翻译

    本文是Unity官方教程,性能优化系列的第一篇<The Profiler window>的简单翻译. 相关文章: Unity性能优化(1)-官方教程The Profiler window翻 ...

  5. jeecg表单页面控件权限设置(请先看官方教程,如果能看懂就不用看这里了)

    只是把看了官方教程后,觉得不清楚地方补充说明一下: 1. 2. 3. 4.用"jeecgDemoController.do?addorupdate"这个路径测试,不出意外现在应该可 ...

  6. [转]Google Guava官方教程(中文版)

    Google Guava官方教程(中文版) http://ifeve.com/google-guava/

  7. Google Guava官方教程(中文版)

    Google Guava官方教程(中文版) 原文链接  译文链接 译者: 沈义扬,罗立树,何一昕,武祖  校对:方腾飞 引言 Guava工程包含了若干被Google的 Java项目广泛依赖 的核心库, ...

  8. OpenGL官方教程——着色器语言概述

    OpenGL官方教程——着色器语言概述 OpenGL官方教程——着色器语言概述 可编程图形硬件管线(流水线) 可编程顶点处理器 可编程几何处理器 可编程片元处理器 语言 可编程图形硬件管线(流水线) ...

  9. [苏飞开发助手V1.0测试版]官方教程与升级报告

           [苏飞开发助手V1.0测试版]官方教程与升级报告导读部分----------------------------------------------------------------- ...

随机推荐

  1. 开发一个iOS应用没有那么容易

    导读:这是来自新加坡的 iOS 开发者 Kent Nguyen 发表在1月底的一篇博文.这篇吐槽文在 iOS 开发圈子里流传甚广,从原文150多个评论就可见一斑,现翻译如下. 让我们开门见山吧:做一个 ...

  2. always语言指导原则

    1.每个always只有一个@(event-expression). 2.always块可以表示时序逻辑和组合逻辑. 3.带有posedge和negedge关键字的是表示沿触发的时序逻辑,没有的表示组 ...

  3. dom4j增删改查

    //dom4j添加内容,在第一本书上指定位置添加售价 更改保存所有孩子list集合的顺序 @Test public void add1() throws Exception{ //读 SAXReade ...

  4. Android crop image size

    private void performCrop() { try { //call the standard crop action intent (the user device may not s ...

  5. struts.properties配置详解(转)

    Struts 2框架有两个核心配置文件,其中struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等.除此之 外,Struts 2框架还包含     s ...

  6. windowopen

    1.最基本的弹出窗口代码] <SCRIPT LANGUAGE="javascript"> <!-- window.open ('page.html') --> ...

  7. threaded模式下,比prefork模式要省资源

    关于nginx + fastcgi + django 2009-03-10 17:14:43 分类: 系统运维 最近用django开发了一套广告投放系统,这套系统其实是一套网络广告联盟系统,包括广告的 ...

  8. Ubuntu环境下手动配置ElasticSearch0.90.5

    1 下载elasticsearch-0.90.5 2 修改配置(可选) 修改内存:(可选) bin/elasticsearch.in.sh中: ES_MIN_MEM ES_MAX_MEM 修改搜索引擎 ...

  9. @QueryParam和@PathParam比较

    来源:http://jackyrong.iteye.com/blog/1128364 1 先来看@queryparam Path("/users") public class Us ...

  10. MyBatis,动态传入表名,字段名的解决办法

    转载:http://luoyu-ds.iteye.com/blog/1517607 今天做项目,遇到的问题就是需求修改数据表的记录,而且字段名都不是固定的,也就是说是需要通过参数传入的, 本来这也不是 ...