RecyclerView预览数据
我们在布局文件里定义RecyclerView时,可以使用tools属性预览数据,如下:
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:itemCount="10"
tools:layoutManager="LinearLayoutManager"
tools:listitem="@layout/item_person_info"
tools:orientation="vertical" />
item_person_info文件定义如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="@tools:sample/full_names" /> <ImageView
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:src="@tools:sample/avatars" />
</android.support.constraint.ConstraintLayout>
预览效果如下:

将tools:layoutManager的值改为GridLayoutManager,预览效果如下:

RecyclerView预览数据的更多相关文章
- Android使用Camera2获取预览数据
一.Camera2简介 Camera2是Google在Android 5.0后推出的一个全新的相机API,Camera2和Camera没有继承关系,是完全重新设计的,且Camera2支持的功能也更加丰 ...
- Android RecyclerView预览item
参考: Android Tools Attributes listItem 和 Sample Data 的用法 笔记 tools:text TextView可以实现预览,不影响实际的效果 例如: to ...
- 结合bootstrap fileinput插件和Bootstrap-table表格插件,实现文件上传、预览、提交的导入Excel数据操作流程
1.bootstrap-fileinpu的简单介绍 在前面的随笔,我介绍了Bootstrap-table表格插件的具体项目应用过程,本篇随笔介绍另外一个Bootstrap FieInput插件的使用, ...
- IDT 数据预览查询
前面做了一件非常愚蠢的事情,由于不会预览数据.我都是直接发布到webi去查看的.可以想象一下了.真是太年轻了.为自己感到十分的汗颜. 在数据基础层做好连接之后,可以查看数据基础 .会显示相应的join ...
- MVC 图片预览
1.页面cshtml <form name="frmInput" id="frmInput" method="post" action ...
- Android Camera开发:使用GLSurfaceView预览Camera 基础拍照
GLSurfaceView是OpenGL中的一个类,也是可以预览Camera的,而且在预览Camera上有其独到之处.独到之处在哪?当使用Surfaceview无能为力.痛不欲生时就只有使用GLSur ...
- Android平台之不预览获取照相机预览数据帧及精确时间截
在android平台上要获取预览数据帧是一件极其容易的事儿,但要获取每帧数据对应的时间截并不那么容易,网络上关于这方面的资料也比较少.之所以要获取时间截,是因为某些情况下需要加入精确时间轴才能解决问题 ...
- Android Camera2 预览功能实现
1. 概述 最近在做一些关于人脸识别的项目,需要用到 Android 相机的预览功能.网上查阅相关资料后,发现 Android 5.0 及以后的版本中,原有的 Camera API 已经被 Camer ...
- Android 使用 Camera2 完成预览和拍照
Android API 21新增了Camera2,这与之前的camera架构完全不同,使用起来也比较复杂,但是功能变得很强大. 在讲解开启预览之前,首先需要了解camera2的几个比较重要的类: Ca ...
随机推荐
- JS实现16进制和RGB转换
作为前端开发而言,不可避免的会遇到颜色取值,字符串和数字直接的转换,博主为此写了一个小工具,实现色值之间的在线转换. 前置知识点: parseInt, toString parseInt(value ...
- 物联网通信 - RESTDemo示例程序(Java版本)
源码下载 -> 提取码 QQ:505645074 Netty的Restful API实现 Get: http://127.0.0.1:8662/test Post http://127.0. ...
- [b0018] python 归纳 (四)_运算符重载
# -*- coding: UTF-8 -*- """ 测试运算符重载 加法 总结: python 运算符表达式其实都是调用 类中方法 __xxx__ + <--- ...
- idea把菜单栏给点没了...(File、Edit、View、Navigate.......)
第一种方法 找到idea的C盘的配置文件ui.lnf.xml文件 第二种方法 如果是高版本idea,我的是2019.3,双击shift选择Actions,搜索menu 然后重启idea
- JSON Web Token 使用详解
JWT 是什么? JSON Web Token(缩写 JWT)是目前最流行的跨域认证解决方案.它是有三部分组成,示例如下,具体的讲解如下(jwt 是不会有空行的,下面只是为了显示,便使用了换行看着比较 ...
- android 开发工具 adb
1.abd基本使用 1.启动一个adb应用程序 adb -P <port> start-server # -P指定端口 默认是5037 1.停止adb adb kill-server 2. ...
- 【Spring IoC】依赖注入DI(四)
平常的Java开发中,程序员在某个类中需要依赖其它类的方法.通常是new一个依赖类再调用类实例的方法,这种开发存在的问题是new的类实例不好统一管理. Spring提出了依赖注入的思想,即依赖类不由程 ...
- zz阿里小蜜—智能服务技术实践及场景探索(AI先行者大会)Final.pdf
SLQA+ 模型
- NOIP 2009 Hankson 的趣味题
洛谷 P1072 Hankson 的趣味题 洛谷传送门 JDOJ 1648: [NOIP2009]Hankson的趣味题 T2 JDOJ传送门 Description Hanks 博士是BT (Bio ...
- 水晶报表报错:log4net初始值问题
运行水晶报表的程序一直出错,报错如下: System.TypeInitializationException: “CrystalDecisions.ReportSource.ReportSourceF ...