Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将一个图像居中于另一个图像的角上_Android_Design Patterns - Fatal编程技术网

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。如果你想要一个更好的答案,请在你的问题中添加一些上下文。虽然这个问题对你来说似乎非常清楚,但你提出的问题留下了很大的解释空间。