gpt4 book ai didi

Android 布局模板

转载 作者:行者123 更新时间:2023-11-29 22:16:07 27 4
gpt4 key购买 nike

<分区>

我正在寻找一种在 android 中进行布局模板化的简单方法。我已经检查了包含和合并技术但没有成功。(我认为可以创建自定义布局并通过代码定义此行为,但我想知道这是否可以通过 xml 完成)

我想定义这样的东西:

 [globalLayout]
<linearLayout params=xxx>
<linearLayout params=yyy>
<?yied ?>
</linearLayout>
</linearLayout>


[customView1]
<Linearlayout>
<ImageView />
<Button/>
</LinearLayout>


[customView2]
<Linearlayout>
<Button/>
<Button/>
<Button/>
</LinearLayout>

(这3个xml应该是可重用的)

 [HomeLayout]
<?include globalLayout >
<?include customView1 />
</include>


[ParamsLayout]
<?include globalLayout >
<?include customView2 />
</include>

问题是我想要一个可重用的布局,如果执行一个小的更改,它会影响所有相关的 View 。有些想法与其他语言的“部分 View 或模板”有关。

谁能帮帮我?

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