开发者

NinePatchDrawable problem when set as a ListView item background

I've got a ListView which gets populated by items programmatically using ListAdapter. As a layout for a single item, I've got an XML defined.

Then, I set up some NinePatchDrawable's in my code and dynamically pop them as a background for a LinearLayout of my single item XML.

Weird thing is that on the Activity opening, it looks fine and stretched, as planned. But a second after this it "resets" for some reason so it now does not have a correct footer of the image. When scrolling the list it gets fine (stretched) or not (not stretched) from time to time, randomly.

I've checked my drawables to be good *.9.png's and so on.

What is wrong here, as it work开发者_开发技巧s the same on Emulator and on device as well?

UPDATE:

here's my XML part for LinearLayout in question:

<LinearLayout 
    android:layout_height="wrap_content" 
    android:background="@drawable/messagereceived" 
    android:layout_width="wrap_content" 
    android:layout_marginLeft="8dip" 
    android:layout_marginTop="5dip" 
    android:id="@+id/linBg" 
    android:layout_marginRight="8dip">
    <TextView 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_marginBottom="5dip" 
        android:layout_marginTop="5dip" 
        android:layout_marginLeft="15dip" 
        android:text="Received message" 
        android:textColor="#ffffffff" 
        android:id="@+id/txtMessage" 
        android:layout_marginRight="15dip"/>
</LinearLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜