Solution 1 :
Use ConstraintLayout
<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">
<com.google.android.libraries.onegoogle.account.particle.AccountParticle
xmlns_android="http://schemas.android.com/apk/res/android"
android_id="@+id/part_a"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
app_layout_constraintStart_toStartOf="parent"
app_layout_constraintTop_toTopOf="parent"
app_layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android_id="@+id/part_b"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_marginEnd="14dp"
android_layout_marginRight="14dp"
app_layout_constraintTop_toTopOf="parent"
app_layout_constraintBottom_toBottomOf="parent"
app_layout_constraintEnd_toEndOf="parent"
app_srcCompat="@drawable/my_image" />
</android.support.constraint.ConstraintLayout>
Problem :
I have this layout:
<LinearLayout 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_orientation="horizontal">
<com.google.android.libraries.onegoogle.account.particle.AccountParticle
xmlns_android="http://schemas.android.com/apk/res/android"
android_id="@+id/part_a"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_gravity="center_vertical|start" />
<ImageView
android_id="@+id/part_b"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_marginEnd="14dp"
android_layout_marginRight="14dp"
android_layout_gravity="center_vertical|end"
app_srcCompat="@drawable/my_image" />
</LinearLayout>
I would expect part_a
to be aligned to the right and part_b
aligned to the left. (Thanks to android:layout_gravity
).
Why do I see them packed closed to each other?
Comments
Comment posted by MichaelStoddart
Post some code..
Comment posted by Elad Benda
@MichaelStoddart my bad, the xml wasn’t seen