[英]Why does ImageView get smaller by increasing margin top size?
我有一个相对的布局,我想在其中显示一个Imageview
和一个带有background-image
TextView
。
如果我不使用任何页margin-top
它应该如何工作,但是如果我增加ImageView的顶部边距,则图像会变小。
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/playerNameEnd"
android:layout_width="200dp"
android:layout_height="80dp"
android:background="@drawable/casino2"
android:gravity="center"
android:text="Player"
android:textColor="@color/cream"
android:textSize="26sp" />
<ImageView
android:id="@+id/roulette_EndPic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
app:srcCompat="@drawable/casino" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
使用android:paddingTop="40dp"
代替marginTop
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.