是否有可能设置一个背景PNG上一个视图,它锚定到顶部,并在Android中没有形成规模?

StackOverflow https://stackoverflow.com/questions/1320421

我有一个形象,说的 16px的从我们的设计师。我想将其设置为在视图上背景图像,但是该视图是比图像大。所以,我想为锚在视图的顶部的图像,然后让视图填写底部具有的纯色

这是可能的Android中的当前版本,1.5_r3?

下面是我到目前为止有:

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="3dip"
style="@style/listItemStyle">...

其中listItemStyle定义为:

 <style
  name="listItemStyle"
  parent="@android:style/Widget.ListView">
   <item name="android:background">@drawable/list_background</item>
 </style>

但图像扩展到占据整个看法,我不知道如何设置图像为背景,并指定在同一时间纯色。我怀疑需要包装的视图,其中具有指定的颜色的含图,是最好的方法做呢?

有帮助吗?

解决方案

将图像中的的 ImageView的下,然后使用纯色作为项目视图的背景。这是一个可选择的。

干杯

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top