Android:可重用 UI 组件的线性布局与表格布局
我正在尝试定义一个可重用的布局元素,我想将其包含在另一个布局中。但我不确定归档我想要的布局的最佳方法是什么。
可重用组件应该如下所示。
它应该分为 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.
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
RelativeLayout
或LinearLayout
作为父级。在其内部,左侧采用LinearLayout
,右侧采用RelativeLayout
。左边有一个
TableLayout
。这应该给出所需的布局。Have a
RelativeLayout
orLinearLayout
as parent. Inside it take aLinearLayout
for left andRelativeLayout
for right.On left take a
TableLayout
.this should give the required layout.