【发布时间】:2011-12-27 15:14:53
【问题描述】:
所以我要做的是显示列表行元素的背景。我已经创建了行布局并应用了样式:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout1" android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/product1" >
我将样式设置为:
<style name="product1">
<item name="android:background">@drawable/product1</item>
</style>
product1.xml 为:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/prod1"
android:antialias="true"
android:dither="true"
android:filter="false"
android:gravity="right"
android:scaleType="fitXY" />
prod1.9.png 是一个九个补丁集,可在顶部和左侧进行缩放(所以我希望我的图像位于右下角)
但我现在面临的问题是图标显示在角落,而 9patch 没有向左和向上缩放。
如果我不使用样式,而是使用android:background=@drawable/prod1,那么它会缩放,但每一行都会变得非常大。有什么想法吗?
【问题讨论】:
标签: android listview layout background