【发布时间】:2011-09-17 10:21:57
【问题描述】:
我最近制作了我的第一个自定义形状,结果非常好接受一件事。我似乎无法在样式资源中设置可绘制资源的高度和 with。
我没有指定 på 形状的高度或宽度,因为我想以不同的尺寸使用这个形状。所以我在我的styles.xml 文件中设置了高度和宽度。但最终的结果是看起来像我不想要的使用 wrap_content 作为高度和宽度的形状。
非常感谢任何帮助!
形状 - list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid
android:color="@color/list_item_background"
/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:startColor="@color/list_item_gradient_white"
android:endColor="@color/list_item_gradient_black"
android:type="linear"
/>
<stroke
android:color="@color/list_item_stroke"
android:width="1px"
/>
</shape>
</item>
风格
<style name="SmallListItem">
<item name="android:background">@drawable/list_item</item>
<item name="android:layout_height">69.5dip</item>
<item name="android:layout_width">fill_parent</item>
</style>
【问题讨论】:
标签: android height width shape