Android自定義開關按紐:SwitchButton

jopen 10年前發布 | 471K 次閱讀 Android開發 移動開發 SwitchButton

這一個擁有漂亮外觀的Android自定義開關按紐SwitchButton。

使用

在XML布局文件中,您可以配置使用這些屬性設置開關按鈕的外觀。

  • onDrawable: drawable of background for status ON
  • offDrawable: drawable of background for status OFF
  • thumbDrawable: drawable of thumb
  • thumb_margin: set inner margin between thumb and edges
  • thumb_marginLeft/Top/Bottom/Right: set margin for specific edge
  • thumb_width: set the width of thumb, probably used for gradient drawable
  • thumb_height: set the height of thumb
  • onColor: set the color of status ON, usd for flat version, the priority is below of onDrawable
  • offColor: like the onColor
  • thumbColor: like the onColor
  • thumbPressedColor: like the thumbColor, but for pressed status
  • animationVelocity: distance of animation per frame
  • radius: used for color version, radius of corner of background and thumb.
  • measureFactor: factor limit the minimum width equals almost (the height of thumb * measureFactor)

Android自定義開關按紐:SwitchButton

Android自定義開關按紐:SwitchButton

項目主頁:http://www.baiduhome.net/lib/view/home/1416551638055

 

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!