Emi*_*der 5 height android shape width
我最近制作了我的第一个自定义形状,结果非常好接受一件事.我似乎无法在样式资源中设置高度和可绘制资源.
我没有指定på形状的高度或宽度,因为我想使用不同尺寸的这种形状.所以我在styles.xml文件中设置了高度和宽度.但最终的结果是看起来像使用wrap_content作为高度和宽度的形状,我不想要.
任何帮助是极大的赞赏!
SHAPE - 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>
Run Code Online (Sandbox Code Playgroud)
样式
<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>
Run Code Online (Sandbox Code Playgroud)
尝试这样的事情:
<ImageView
style="@style/SmallListItem"
android:src="@drawable/list_item" />
Run Code Online (Sandbox Code Playgroud)
有关如何使用图层列表的更多信息,请参阅http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList