gpt4 book ai didi

android - 很难将 child 与另一个 child 之间的最左和最右对齐

转载 作者:行者123 更新时间:2023-11-30 00:38:19 25 4
gpt4 key购买 nike

我想要左右显示两个图像,并在它们之间显示一个 TextView ,距离左侧图像只有一小段距离,但我无法完成。

<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal">

<ImageView
android:id="@+id/image_of_services"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:src="@drawable/ic_menu_camera" />

<TextView
android:id="@+id/name_of_services"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:text="adasdsad"
android:layout_weight="8"
android:textSize="20sp" />

<ImageView
android:id="@+id/image_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="2"
android:src="@drawable/ic_menu_camera" />
</LinearLayout>

最佳答案

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10"
xmlns:android="http://schemas.android.com/apk/res/android">

<ImageView
android:id="@+id/image_of_services"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"

android:layout_weight="2"
android:src="@drawable/ic_menu_camera" />

<TextView
android:id="@+id/name_of_services"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="adasdsad"
android:layout_weight="6"
android:textSize="20sp" />

<ImageView
android:id="@+id/image_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="2"
android:src="@drawable/ic_menu_camera" />
</LinearLayout>`

关于android - 很难将 child 与另一个 child 之间的最左和最右对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43030069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com