Java 对齐以使多个图像视图在线性布局中并排居中
所以,我想得到的是:Java 对齐以使多个图像视图在线性布局中并排居中,java,android,xml,android-studio,Java,Android,Xml,Android Studio,所以,我想得到的是: img1 img2 img3 | | I want it to be centered in this ImageView img 1 img2 img3 | | It is centered in this ImageView 虽
img1 img2 img3
|
|
I want it to be centered in this ImageView
img 1 img2 img3
|
|
It is centered in this ImageView
虽然我得到的是:
img1 img2 img3
|
|
I want it to be centered in this ImageView
img 1 img2 img3
|
|
It is centered in this ImageView
我在这个网站上读了很多像这样的问题,但没有任何帮助!我见过有人使用android:gravity=“center”
或android:layout\u gravity=“center”
。什么都帮不了我!我不知道我最好的选择是什么。如果有人帮助我,我将不胜感激
这是我的.xml文件:
<HorizontalScrollView
android:id="@+id/scrlVPrincipal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/imgCard1"
android:layout_width="259dp"
android:layout_height="390dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.504"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.801"
/>
<ImageView
android:id="@+id/imgCard2"
android:layout_width="259dp"
android:layout_height="390dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8" />
<ImageView
android:id="@+id/imgCard3"
android:layout_width="259dp"
android:layout_height="390dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8" />
</LinearLayout>
</HorizontalScrollView>
是否要在屏幕上固定三个大小相同的图像?@Abhishekkumar No.我的目的是使第二个图像显示在屏幕上,然后,如果用户向左滑动,左图像就会出现,而vice Versu只想显示三张或更多的图像吗?@Nikuncpatel Just 3U当时的意思是只显示一张图像,然后在屏幕上滑动另一张图像