【发布时间】:2018-06-06 16:06:12
【问题描述】:
我只是想用 constraintlayout 做这种对齐,但我不确定这是否可能。
我该怎么做?
示例 xml
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/com_facebook_profile_picture_blank_portrait" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
app:srcCompat="@android:color/holo_green_light" />
我的解决方法。
【问题讨论】:
-
允许还是不允许是什么意思?
-
一般用coordinator layout来完成。我的意思是这是否可能,如果可能的话,这是正确的方法。
-
是的,一切皆有可能,除非它满足您的要求,否则它不会出错。这是可能的,我相信你已经做到了。 :)
-
@Umair 如果您的意思是我的解决方法,它可能会在不同的屏幕上显示不同。
标签: android android-layout android-constraintlayout