我有一個線性佈局,其中有2個文本視圖。但是在文本視圖之間有一些填充。如何刪除填充?我附上了一個截圖和源代碼。線性佈局內的文本
我不需要33%和完成之間的任何空間。
截圖:https://www.dropbox.com/s/e69loke90q9c6nt/snip4.PNG
代碼:
<TextView
android:id="@+id/toptext"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:layout_marginBottom="0"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="33%"
android:textSize="24sp" />
<TextView
android:id="@+id/bottomtext"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Completed"
android:textSize="10dp" />
</LinearLayout>
全碼
<?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="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<TextView
android:id="@+id/deckno"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Deck 1"
android:textSize="24dp"
android:gravity="center_vertical"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="fill_parent">
<TextView
android:id="@+id/toptext"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:layout_marginBottom="0"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="33%"
android:textSize="24sp" />
<TextView
android:id="@+id/bottomtext"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:text="Completed"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
感謝和問候,
在這裏展示您的詳細XML代碼,這將是很容易找到的錯誤在你的代碼 – 2013-05-03 11:52:51
這單獨產生問題 – 2013-05-03 11:54:08
這可能是因爲爲'TextView'提供了'layout_weight'。顯示完整的版面 – Renjith 2013-05-03 11:54:08