gpt4 book ai didi

android - 实现这个布局

转载 作者:太空宇宙 更新时间:2023-11-03 12:55:17 24 4
gpt4 key购买 nike

我想实现这样的布局:

enter image description here

我能找到的最近的是:

enter image description here

目前的布局是这样的:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:baselineAligned="true"
android:orientation="vertical"
android:weightSum="4" >

<LinearLayout

android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="8dip" >

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />
</LinearLayout>

<LinearLayout

android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="8dip"

>

<ImageButton

android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage"

/>

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />
</LinearLayout>

<LinearLayout

android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="8dip" >

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />
</LinearLayout>

<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="8dip" >

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/myimage" />
</LinearLayout>

</LinearLayout>

如何设计上面的布局?

最佳答案

创建三个方向设置为垂直且布局权重相等的线性布局。每个线性布局的 subview 也必须具有相等的布局权重。将第一个和第三个线性布局的重力设置为 center_vertical。

关于android - 实现这个布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21351225/

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