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之后,我们可以发现它的强大之处有这么几点 ...
随机推荐
- 如何区分对象、数组、null
我们都知道在使用typeof的时候对象.数组.null返回的都是object 那么我们怎么来区分他们呢? 我们知道万物皆对象,那么我们就利用对象的toString来区分 这样是不是就很容易区分了呢! ...
- B站视频下载
借助Chrome插件 bilibili哔哩哔哩下载助手 在谷歌应用商城下载安装后在在浏览器右上角显示如下图标 打开想要下载的视频,网页右下角会有如下图标,点击该图标 点击下面的合并下载按钮即可 htt ...
- OS 常见函数使用
os.sep:取代操作系统特定的路径分隔符 os.name:指示你正在使用的工作平台.比如对于Windows,它是'nt',而对于Linux/Unix用户,它是'posix'. os.getcwd:得 ...
- webstorm 注册服务器
之前都是使用2017.2.27的方法,版本是2017.1.1,还没提示过期,但是根据评论说这个链接已经失效了,评论也给出了个新地址:http://idea.iteblog.com/key.php
- BIO、NIO、AIO 有什么区别?(未完成)
BIO.NIO.AIO 有什么区别?(未完成)
- P4016 负载平衡问题(最小费用最大流)
P4016 负载平衡问题 题目描述 GG 公司有 nn 个沿铁路运输线环形排列的仓库,每个仓库存储的货物数量不等.如何用最少搬运量可以使 nn 个仓库的库存数量相同.搬运货物时,只能在相邻的仓库之间搬 ...
- hdu4612 Warm up[边双连通分量缩点+树的直径]
给你一个连通图,你可以任意加一条边,最小化桥的数目. 添加一条边,发现在边双内是不会减少桥的.只有在边双与边双之间加边才有效.于是,跑一遍边双并缩点,然后就变成一棵树,这样要加一条非树边,路径上的点( ...
- c++中lambda表达式的用法
#include <iostream> using namespace std; int main(){ ; auto func1 = [=](;}; auto func2 = [& ...
- learning armbian steps(8) ----- armbian 源码分析(三)
在lib/main.sh当中 ) == main.sh ]]; then echo "Please use compile.sh to start the build process&quo ...
- IntelliJ IDEA 运行项目的时候提示 Command line is too long 错误
在 IntelliJ IDEA 项目运行的时候收到了下面的错误提示: Error running 'Application': Command line is too long. Shorten co ...