我有一堆滑块,我正在尝试应用自定义拇指。它的尺寸是12x20,我使用合成器的外观和感觉使用下面的代码。这会正确显示水平滑块的拇指,但是一旦我做出垂直滑块,拇指就会在边缘上变形。有没有更好的方法来做到这一点?此外,拇指按下的代码没有做任何事情,我会认为这是因为sliderThumbs没有“按下状态”?有没有办法让L& F在按下时改变滑块?先谢谢!!!
干杯, 卢卡斯
<!-- Make and Bind a SliderThumb style -->
<style id="sliderStyle">
<state>
<property key="Slider.paintValue" type="boolean" value="false"/>
<property key="Slider.thumbWidth" type="integer" value="12"/>
<property key="Slider.thumbHeight" type="integer" value="21"/>
</state>
</style>
<bind style="sliderStyle" type="region" key="slider" />
<style id="SliderTrackStyle">
<opaque value="FALSE"/>
</style>
<bind style="SliderTrackStyle" type="region" key="sliderTrack" />
<style id="sliderThumbStyle">
<state>
<imagePainter method="sliderThumbBackground" path="Images/SliderThumb.png"
sourceInsets="0 0 0 0"/>
</state>
<state value="PRESSED">
<imagePainter method="sliderThumbBackground" path="Images/SliderThumbPressed.png"
sourceInsets="0 0 0 0"/>
</state>
</style>
<bind style="sliderThumbStyle" type="region" key="sliderThumb" />
答案 0 :(得分:0)
使用矢量图形。在我的一个应用程序中,我最初使用的是png文件,与您相同。当我切换到矢量图形时,边缘在较小的按钮上使用时不会撕裂。