【发布时间】:2018-01-15 08:55:49
【问题描述】:
我正在构建一个聊天应用程序,当我向用户发送图像时,图像没有覆盖我给定的背景,而是在顶部和底部提供有线填充。如何解决这个问题。我给的填充是每边 7dp 这是我的代码
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<android.support.constraint.ConstraintLayout
android:layout_width="wrap_content"
android:id="@+id/photo"
android:background="@drawable/toolbar_background"
app:layout_constraintRight_toRightOf="parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageContentUser"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:src="@drawable/doc"
android:padding="0dp"
android:adjustViewBounds="true"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
【问题讨论】:
-
你可以在发布问题之前谷歌...删除 android:src="@drawable/doc" 并使用 android:background="@drawable/doc" , android:scaleType="fitXY"跨度>
标签: xml android-studio