<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 第一坑的更多相关文章

  1. android data binding jetpack V 实现recyclerview 绑定

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  2. android data binding jetpack II 动态数据更新

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  3. android data binding jetpack I 环境配置 model-view 简单绑定

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  4. android data binding jetpack VIII BindingConversion

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  5. android data binding jetpack VII @BindingAdapter

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  6. android data binding jetpack VI 清理一些概念。BR 运算表达式

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  7. android data binding jetpack IV 绑定一个方法另一种写法和参数传递

    android data binding jetpack VIII BindingConversion android data binding jetpack VII @BindingAdapter ...

  8. android data binding jetpack III 绑定一个方法

    第三篇 给view绑定一下方法响应. (补充:1.被绑定的方法必须是public的.   1.绑定方法可以用主语法.也可以用以下双冒号方式“::” android:onClick="@{pr ...

  9. Android Data Binding代码实践(告别findViewById)(四)

    Data Binding实战(一) Data Binding语法解析(二) Data Binding高级用法(三) 好了,继前三篇学习了Data Binding之后,我们可以发现它的强大之处有这么几点 ...

随机推荐

  1. window上mongoDB的安装及常用mongodb命令

    前几天在学习node操作数据库时使用的mongoDB数据库,今天来对mongodb的安装过程及配置以及后面需要使用的一些常用命令做一下总结. 安装MongoDB (可参考菜鸟教程中的安装步骤) 首先, ...

  2. 选择webpack这条路,我踩过的坑

    在http://www.jianshu.com/p/42e11515c10f这篇文章,我重新学习了一下webpack. 一.json文件里面不应该含有注释,否则会报错 本来我的json文件长这个样子: ...

  3. mock.js学习之路(二)easy-mock(Vue中使用)

    1.easy-mock建立外部数据,注册账号,创建数据,详细使用过程参照https://www.easy-mock.com/docs文档说明 2.项目中如何引入使用 ①配置一下config.index ...

  4. HTML5学习:表格

    HTML代码 <table> <thead> <tr> <th>标题1</th> <th>标题2</th> < ...

  5. 使用 visual studio 2019 社区版打开touchgfx工程注意项

    @2019-09-23 [环境] touchgfx designer 4.10.0 visual studio 2019 社区版 [问题] #error 1 使用 visual studio 2019 ...

  6. Java中Static关键字详解以及静态变量和成员变量的区别

    一.static关键字的特点 (1)修饰成员变量.成员方法(2)随着类的加载而加载(3)优先于对象存在(4)被所有对象共享(5)可以通过类名调用 它本身也可以通过对象名调用 例如:main()方法由j ...

  7. (a ==1 && a== 2 && a==3) 有可能是 true 吗?

    今天看到这个题目,感到很有意思,查找了些资料,各位牛人果然有高招解决: 方法一: var a = { i: 1, toString: function () { return a.i++; } } i ...

  8. 01 数据库sql

    1, 关于mysql,常去的地方有:https://www.yiibai.com/mysql, http://tool.oschina.net/apidocs/apidoc?api=mysql-5.1 ...

  9. HTML5——5 HTML5 SVG

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. 记一次基于 mpvue 的小程序开发及上线实战

    小程序名称:一起打车吧 项目地址: 客户端:https://github.com/jrainlau/taxi-together-client 服务端:https://github.com/jrainl ...