2011-02-17 98 views

回答

1

那就試試這個

<TableRow android:layout_height="wrap_content" android:id="@+id/tableRow1" android:background="@drawable/dot" 
    android:layout_width="fill_parent"> 

    <TextView android:layout_height="wrap_content" 
     android:layout_width="wrap_content" android:text="Your text"></TextView> 

</TableRow> 

我已經錶行

這將滿足您的需求量的中設置的背景虛像。

1

假設你需要給你的tablelayout 10dip的保證金。因此,而不是給予10浸的保證金就可以使用圖像使用下面的公式

像素= DPS *(密度/ 160)

我希望有與計算出的大小您所選擇的點這應該工作

+0

我是新來的機器人。我不知道如何實現這一點。 你可以有一個相關的例子或任何好的教程? – 2011-02-17 11:22:47

0

下面是代碼

<?xml version="1.0" encoding="utf-8"?> 

<TableLayout android:layout_height="wrap_content" android:stretchColumns="1" 
    android:id="@+id/tableLayout1" android:layout_width="wrap_content"> 
    <TableRow android:layout_height="wrap_content" android:id="@+id/tableRow1" 
     android:layout_width="fill_parent"> 
     <ImageView android:layout_width="wrap_content" android:src="@drawable/dot" 
      android:layout_height="fill_parent"></ImageView> 
     <TextView android:layout_height="wrap_content" 
      android:layout_width="wrap_content" android:text="Your text"></TextView> 
     <ImageView android:layout_width="wrap_content" android:src="@drawable/dot" 
      android:layout_height="fill_parent"></ImageView> 
    </TableRow> 
</TableLayout> 

enter image description here

+0

非常感謝。在你使用這個公式的地方=>像素= DPS *(密度/ 160)? – 2011-02-17 11:59:26

+0

那麼,我沒有使用過,我已經應用了四處看看和更好的解決方案...反正這是否滿足您的要求? – 2011-02-17 12:04:42