是否有可能在Android的UI双表格布局 [英] Is it possible to have two table layout in android UI
问题描述
我需要显示两个不同的表中的一个UI,我试图表格布局的原因,很容易通过表格布局有表结构。但我无法在一个画面中有两个表的布局。我试图添加表布局视图在父布局,例如相对或线性布局,也没有工作。然后,我尝试将表添加为行父表的布局,但没有什么工作。它没有显示出任何错误或警告,而膨胀的观点,但它只是只显示最后一个表格的布局。它是不可能在一个屏幕上有两个表的布局。
I need to show two different tables in one UI, i tried for table layout cause it is easy to have table structures through table layout. But i could not have two table layout in one screen. I tried to add the table layout views in a parent layout,e.g Relative or Linear layout, it did not work. Then i tried to add the tables as row in a parent table layout, But nothing is working. It did not show any error or warning while inflating the view, but it just show last table layout only. Is it not possible to have two table layout in one screen.
推荐答案
总结两 TableLayouts
在的LinearLayout
并定义的android:layout_weight
在 TableLayouts
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ff0000" >
</TableLayout>
<TableLayout
android:id="@+id/tableLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#00ff00" >
</TableLayout>
这篇关于是否有可能在Android的UI双表格布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!