如何在 Android Studio 中证明内容的合理性 - XML

Mar*_*rio 2 xml android justify

我想知道是否可以像LinearLayout我通常在网络上所做的那样,在 Android Studio 中证明 a 的内容是合理的。

网页CSS

.space-around {
  display: flex;
  justify-content: space-around;
}
Run Code Online (Sandbox Code Playgroud)

所做space-around的就是均匀分布在行中,周围空间相等,使内容适合 div (链接

我怎样才能在我的 Android Studio 中获得相同的效果LinearLayout

安卓

  <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="90dp"
            android:orientation="horizontal">
  </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

小智 5

你可以这样:只需给 LinearLayout 的内部元素相同的权重:

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    >
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        />
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        />
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
    />
    <TextView
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
    />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)