Android 将一个图像居中于另一个图像的角上
我怎样才能把一个图像的中心放在另一个图像的角上Android 将一个图像居中于另一个图像的角上,android,design-patterns,Android,Design Patterns,我怎样才能把一个图像的中心放在另一个图像的角上 您可以使用ConstraintLayout获取此行为,例如: <?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/
您可以使用
ConstraintLayout
获取此行为,例如:
<?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="match_parent">
<ImageView
android:id="@+id/imageViewCenter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent"
app:srcCompat="@drawable/drawable1" />
<ImageView
android:id="@+id/imageViewToPosition"
android:layout_width="50dp"
android:layout_height="50dp"
app:layout_constraintBottom_toTopOf="@id/imageViewCenter"
app:layout_constraintStart_toEndOf="@id/imageViewCenter"
app:layout_constraintEnd_toEndOf="@id/imageViewCenter"
app:layout_constraintTop_toTopOf="@id/imageViewCenter"
app:srcCompat="@drawable/drawable2" />
</android.support.constraint.ConstraintLayout>
使用Photoshop或Gimp。如果你想要一个更好的答案,请在你的问题中添加一些上下文。虽然这个问题对你来说似乎非常清楚,但你提出的问题留下了很大的解释空间。