有谁用过Synth,今天在写XML文件时,编译通不过,代码如下
<style id="scrollBarThumbStyle">
<state>
<imagePainter method="scrollBarThumbBackground"
direction="horizontal"
path="images/scroll_thumb_horiz_grip.png"
paintCenter="true"
/>
</style>
<bind style="scrollBarThumbStyle" type="region" key="ScrollBarThumb" />
目的是想把图片居中,但是这样写提示Error parsing: org.xml.sax.SAXException: property: you must specify sourceInsets null
如果直接定义sourceInsets的值发现图片不是居中的。
<style id="scrollBarThumbStyle">
<state>
<imagePainter method="scrollBarThumbBackground"
direction="horizontal"
path="images/scroll_thumb_horiz_grip.png"
paintCenter="true"
/>
</style>
<bind style="scrollBarThumbStyle" type="region" key="ScrollBarThumb" />
目的是想把图片居中,但是这样写提示Error parsing: org.xml.sax.SAXException: property: you must specify sourceInsets null
如果直接定义sourceInsets的值发现图片不是居中的。
这是我从网上看到的一段示例代码,希望对楼主有用:
<imagePainter
path="bg.jpg"
method="panelBackground"
sourceInsets="2 2 2 2"
paintCenter="true" />
<insets top="4" left="6" bottom="4" right="6"/>