Android:可重用 UI 组件的线性布局与表格布局

发布于 2024-10-02 12:24:46 字数 350 浏览 2 评论 0原文

我正在尝试定义一个可重用的布局元素,我想将其包含在另一个布局中。但我不确定归档我想要的布局的最佳方法是什么。

可重用组件应该如下所示。

Layout

它应该分为 3 个区域。每个区域都会有一个单独的背景图像。左侧的两个区域都应包含 2 个 TextView,而右侧的区域应包含 3 个 TextView。整个组件应该填充屏幕的宽度。

我已经开始构建布局,但我仍然不确定是通过嵌套多个 LinearLayout 还是使用 TableLayout 来完成。

我应该走哪条路?或者您会建议一种完全不同的方法吗?

I'm trying to define a reusable layout element I want to include in another layout. But I'm not sure what's the best way to archive the layout I want.

The reusable component should look like this.

Layout

It should be separated into 3 areas. Each area will get a separate background image.The both areas on the left should each contain 2 TextViews whereas the right area should contain 3 TextViews. The whole component should fill the width of the screen.

I've already started to build the layout but I'm still not sure whether to do it by nesting multiple LinearLayouts or by using a TableLayout.

Which way should I go? Or would you suggest a totally different approach?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

菊凝晚露 2024-10-09 12:24:46

RelativeLayoutLinearLayout 作为父级。在其内部,左侧采用 LinearLayout ,右侧采用 RelativeLayout

左边有一个 TableLayout 。这应该给出所需的布局。

Have a RelativeLayout or LinearLayout as parent. Inside it take a LinearLayout for left and RelativeLayout for right.

On left take a TableLayout .this should give the required layout.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文