我希望ImageView
位于最右边
看图片第一行有一个白色ImageView
如何让它贴在右边。使用Android布局检查器,ImageView
显示左右两侧都有空白区域。是否有一些重力留下了我可以使用的东西?
这是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="wrap_content"
android:layout_margin="5dp"
android:background="?AppTheme.line_box_background_1">
<android.support.constraint.Guideline
android:id="@+id/guideline32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.74"/>
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="?AppTheme.list_item_background"
app:layout_constraintBottom_toTopOf="@+id/guideline567"
app:layout_constraintEnd_toStartOf="@+id/guideline32"
app:layout_constraintStart_toStartOf="@+id/guideline67"
app:layout_constraintTop_toTopOf="parent"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1">
<android.support.constraint.Guideline
android:id="@+id/guideline5654"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"/>
<ImageView
android:id="@+id/imageView_extra"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline5654"
app:srcCompat="@drawable/ic_create_port_place"/>
<TextView
android:id="@+id/text_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:autoSizeTextType="uniform"
android:textColor="?AppTheme.PrimaryTextColor"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/text_extra"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:text="some text"/>
<TextView
android:id="@+id/text_extra"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:autoSizeTextType="uniform"
android:gravity="center"
android:textColor="?AppTheme.PrimaryTextColor"
app:layout_constraintBottom_toTopOf="@+id/text_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_content"
tools:layout_constraintBottom_creator="1"
tools:layout_constraintLeft_creator="1"
tools:text="some text"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.212"/>
</android.support.constraint.ConstraintLayout>
<ImageView
android:id="@+id/imageView_street_image"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:contentDescription=""
android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/guideline567"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline32"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/imageView_google_place"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:contentDescription=""
app:layout_constraintBottom_toTopOf="@+id/guideline567"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/guideline32"
app:layout_constraintTop_toBottomOf="@+id/imageView_street_image"
app:srcCompat="@drawable/powered_by_google_on_white"/>
<ImageView
android:id="@+id/imageView_flag"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@+id/guideline521"
app:layout_constraintEnd_toStartOf="@+id/guideline67"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_circle"/>
<android.support.constraint.Guideline
android:id="@+id/guideline67"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.17"/>
<android.support.constraint.Guideline
android:id="@+id/guideline567"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.89"/>
<TextView
android:id="@+id/text_country"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:autoSizeTextType="uniform"
android:gravity="center|top"
android:text="country"
app:layout_constraintBottom_toTopOf="@+id/guideline567"
app:layout_constraintEnd_toStartOf="@+id/guideline67"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline521"
app:layout_constraintVertical_bias="0.050000012"/>
<android.support.constraint.Guideline
android:id="@+id/guideline521"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.4"/>
</android.support.constraint.ConstraintLayout>