java - 我如何删除 RecyclerView 中 CardView 中的额外边距

标签 java android android-recyclerview android-cardview

如何删除这个额外的 margin ,我尝试使用 this答案但不起作用。

enter image description here

我的代码 CardView

< LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: card_view = "http://schemas.android.com/apk/res-auto"
xmlns: tools = "http://schemas.android.com/tools"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content" >

 < android.support.v7.widget.CardView
android: id = "@+id/cartaExposicion"
android: layout_width = "wrap_content"
android: layout_height = "300dp"
card_view: cardPreventCornerOverlap = "false" >

 < ImageView
android: id = "@+id/imgExposicion"
android: layout_width = "wrap_content"
android: layout_height = "300dp"
android: src = "@mipmap/makuma_0salas" / >
 < /android.support.v7.widget.CardView> < /LinearLayout>

编辑

我需要删除cardview中的间距

enter image description here

enter image description here

最佳答案

尝试为卡片 View 内容填充提供负值

card_view:contentPadding="-5dp"

如果要不均匀地去除padding。尝试为 contentPaddingLeft、contentPaddingRight、contentPaddingBottom 和 contentPaddingTop 提供不同的值。

希望这对你有用。

关于java - 我如何删除 RecyclerView 中 CardView 中的额外边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35068211/

相关文章:

java - Java中的RSA加密/PHP中的解密失败

java - 使用 AsyncTask 时出现运行时异常

android - 如何使用 View 从我的适配器获取索引?

android - RecyclerView 回收 ViewHolder Image View 尺寸错误

java - 简单的子串问题

java - 没有@Autowired的依赖注入(inject)

java - Android解析查询2个类

android - RecyclerView 概念如何在 Android 上运行?

java - 使用 Spring Boot 和 Wicket AuthenticatedWebApplication 过滤注册

java - 如何通过ViewpagerAdapter访问 View ?