android data binding jetpack VIIII 第一坑
<LinearLayout
android:id="@+id/ll_item_home_page_pics"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_item_home_page_top"
android:layout_marginTop="10dp"
android:orientation="horizontal"> <ImageView
android:id="@+id/iv_pic0"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/tempic"
bind:url="@{product.imgUrls.get(0)}"
tools:ignore="ContentDescription" /> <ImageView
android:id="@+id/iv_pic1"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/tempic1"
bind:url="@{product.imgUrls.get(1)}"
tools:ignore="ContentDescription" /> <ImageView
android:id="@+id/iv_pic2"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/tempic2"
bind:url="@{product.imgUrls.get(2)}"
tools:ignore="ContentDescription" />
</LinearLayout>
如上代码,三张图片一行均分布局,LinearLayout + android:layout_weight="1" 很正常的做法。使用glide给图片绑定。
结果-->>>>>图片全出不来。
简单分析也不知道哪个环节出问题了。根本问题是图片的宽高没了。
项目紧先给个解决方案,后期再分析原因。
改用tablelayout 后正常。没到测试期,不知道其它版本系统是不是有问题。
<TableLayout
android:id="@+id/ll_item_home_page_pics"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_item_home_page_top"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:stretchColumns="*"> <TableRow> <ImageView
android:id="@+id/iv_pic0"
android:layout_width="0dp"
android:layout_height="80dp"
android:scaleType="fitXY"
android:src="@drawable/tempic"
bind:url="@{product.imgUrls.get(0)}"
tools:ignore="ContentDescription" /> <ImageView
android:id="@+id/iv_pic1"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:scaleType="fitXY"
android:src="@drawable/tempic1"
bind:url="@{product.imgUrls.get(1)}"
tools:ignore="ContentDescription" /> <ImageView
android:id="@+id/iv_pic2"
android:layout_width="0dp"
android:layout_height="80dp"
android:scaleType="fitXY"
android:src="@drawable/tempic2"
bind:url="@{product.imgUrls.get(2)}"
tools:ignore="ContentDescription" />
</TableRow> </TableLayout>
注意使用:android:stretchColumns="*" 基本跟android:layout_weight 功能一致。
android data binding jetpack VIIII 第一坑的更多相关文章
- android data binding jetpack V 实现recyclerview 绑定
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack II 动态数据更新
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack I 环境配置 model-view 简单绑定
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack VIII BindingConversion
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack VII @BindingAdapter
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack VI 清理一些概念。BR 运算表达式
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack IV 绑定一个方法另一种写法和参数传递
android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...
- android data binding jetpack III 绑定一个方法
第三篇 给view绑定一下方法响应. (补充:1.被绑定的方法必须是public的. 1.绑定方法可以用主语法.也可以用以下双冒号方式“::” android:onClick="@{pr ...
- Android Data Binding代码实践(告别findViewById)(四)
Data Binding实战(一) Data Binding语法解析(二) Data Binding高级用法(三) 好了,继前三篇学习了Data Binding之后,我们可以发现它的强大之处有这么几点 ...
随机推荐
- 使用nodejs对Marketing Cloud的contact主数据进行修改操作
假设在Marketing Cloud有这样一个contact主数据: 现在需求是使用编程语言比如nodejs修改这个contact实例的高亮属性. 代码如下: var config = require ...
- Spring Cloud(一)服务的注册与发现(Eureka)
Spring Cloud是一个基于Spring Boot实现的云应用开发工具,它为基于JVM的云应用开发中涉及的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策竞选.分布式会话和集 ...
- 一周死磕fastreport ----ASP.NET (一)
https://blog.csdn.net/wuyuander/article/details/52692435 原文链接,点击跳转 首先是安装好FastReport .net: 然后在vs2012中 ...
- Hyperscan简介
Hyperscan是一款来自于Intel的高性能的正则表达式匹配库. 参考 Hyperscan简介
- SQLite3学习笔记(1)
命令: DDL-数据定义: CREATE -- 创建一个新的表,一个表的视图,或者数据库中的其他对象 ALTER -- 修改数据库中的某个已有的数据对象,比如一个表 DROP -- 删除整个表,或者表 ...
- 洛谷 P3119 [USACO15JAN]草鉴定Grass Cownoisseur (SCC缩点,SPFA最长路,枚举反边)
P3119 [USACO15JAN]草鉴定Grass Cownoisseur 题目描述 In an effort to better manage the grazing patterns of hi ...
- Java&Selenium自动化测试之数据驱动
一.摘要 本片博文以四个方式展示自动化测试的数据驱动,数组.CSV.Excel.Mysql 二.TestNG&Csv&Driven package testNGWithDataDriv ...
- node监听80端口权限问题
报了这个错误: Error: listen EACCES: permission denied 127.0.0.1:80 at Server.setupListenHandle [as _listen ...
- 【转载】@Component, @Repository, @Service的区别
@Component, @Repository, @Service的区别 官网引用 引用spring的官方文档中的一段描述: 在Spring2.0之前的版本中,@Repository注解可以标记在任何 ...
- Linux权限操作(用户和组)
useradd 添加用户useradd -u uid user 创建指定uid的用户-o 配合-u 不检查uid的唯一性-d 指定家目录-s 指定shell-r 创建系统用户-m 强制创建家目录-M ...