0

我有一堆滑块,我正在尝试对其应用自定义拇指。它的尺寸是 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" />
4

1 回答 1

0

使用矢量图形。在我的一个应用程序中,我最初使用的是 png 文件,和你一样。当我切换到矢量图形时,在较小的按钮上使用时边缘不会撕裂。

于 2011-04-12T09:23:20.657 回答