2011-09-21 52 views
2

我在我的應用程序中有一個使用不同佈局的項目的適配器的列表視圖。在我的Android應用程序中的ListView項背景圖像問題

我希望結果像附在exp_result.png中一樣。 http://imageshack.us/photo/my-images/717/expresult.png/

但不幸的是 - 我得到了像result.png。 http://imageshack.us/photo/my-images/839/resultf.png/

問題是圖像在屏幕上的延伸不是我想要的方式。 任何想法?

也許這種佈局的其他解決方案 - 可能內置?

因爲我無法上傳圖片,所以可拖拽位於鏈接中。原始圖片與exp_result.png中的第一個列表視圖項目相似。我想爲每個頂部,按鈕和中間使用1張圖片,並且無論使用listview項目大小都可以使用它。 XML是:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/list_up" > 
    <TextView 
     android:id="@+id/name_entry" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="28dip" /> 
    <TextView 
     android:id="@+id/number_entry" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="28dip" /> 
</LinearLayout> 

我真的可以真的在這裏使用一些幫助。

約阿夫

+0

安置自己的佈局和繪製個XML。 – dmon

+0

Drawables在鏈接中,因爲我無法上傳圖片。原始圖片與exp_result.png中的第一個列表視圖項目相似。 – Yoav

回答

1

這可能是9補丁圖像類型的一個很好的應用:

9-Patch

+0

好點,也許這實際上會解決你所有的問題。 – dmon

+0

適合我 - 非常感謝! – Yoav

+0

標記爲答案? –