How to auto center crop ImageView Android?(如何自动居中裁剪 ImageView Android?)
问题描述
我做了一个 listView 图像.我的目标是我的 listView 的每个项目都具有相同的 100dp 高度.我遇到了一个问题,我的 imageView 会自动调整大小,但不会占用父级的整个空间.
I made a listView images. My goal that each item of my listView have the same height of 100dp. I encounter a problem that my imageView is resized automatically, but does not take the entire space of the parent.
这是我目前的结果和 objectif 结果:
有谁知道添加自动裁剪中心的选项吗?
推荐答案
我不确定我是否理解正确.我猜它一定是你想要的两者中的任何一个.
I am not sure if I understood correctly. It must be either of the two, that you want, I guess.
在你的图像视图中设置属性
In your image view set the attribute
android:scaleType="fitXY"
完全适合ImageView
.
你可以选择
android:scaleType="centerCrop"
裁剪中心.
这篇关于如何自动居中裁剪 ImageView Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何自动居中裁剪 ImageView Android?


- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01