美好的一天,我有以下圖片的麻煩。正如你所看到的,表格行佔用了太多的空間,我想減少它們,因爲它們下面還有其他的視圖小部件。我怎麼能做到這一點?謝謝。TableRow需要比平常更多的空間android tablelaayout
這是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="3"
android:padding="8dp"
android:background="@drawable/rounded_date_filter">
<TableRow
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/datefilter_text_from_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="@string/from_text">
</TextView>
<TextView
android:id="@+id/datefilter_text_to_id"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="40dp"
android:layout_marginTop="10dp"
android:text="01-01-2012">
</TextView>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:background="#606060">
</View>
<TableRow>
<TextView
android:id="@+id/datefilter_text_from_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="@string/to_text">
</TextView>
<TextView
android:id="@+id/datefilter_text_to_id"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="40dp"
android:layout_marginTop="10dp"
android:text="01-09-2012">
</TextView>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:background="#606060">
</View>
<TableRow>
<TextView
android:id="@+id/datefilter_text_from_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="@string/groupby">
</TextView>
<TextView
android:id="@+id/datefilter_text_to_id"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="40dp"
android:layout_marginTop="10dp"
android:text="day">
</TextView>
</TableRow>
</TableLayout>
<Button
android:id="@+id/reset_filter_button_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/reset_filters">
</Button>
</LinearLayout>
從'TableRows'取出佈局重量。 – Luksprog
@Luksprog對於遲到的回覆感到抱歉。我已經這樣做了,但它並沒有幫助 – irobotxxx