Custom seekbar with material design

前端 未结 2 1659
生来不讨喜
生来不讨喜 2021-01-05 22:27

I\'ve got a seekbar in a layout for a custom dialog preference. I changed my styles.xml to use the new material desing. It works because it change text and checkboxes of my

相关标签:
2条回答
  • 2021-01-05 23:08

    With Lollipop it's no more needed at all. The colors are applied well even in custom preference dialogs ~greywolf82

    I want to share few custom Libs

    enter image description here

    You can use this Material Design lib ,this also includes many other widgets.

    or

    enter image description here

    Custom seek bar Lib DiscreteSeekBar

    0 讨论(0)
  • 2021-01-05 23:18

    You don't need to specify the android:theme attribute on your SeekBar element. Instead, you should set up the default dialog and alert dialog themes in your AppBaseTheme:

    <style name="AppBaseTheme" parent="android:Theme.Material">
        ...
        <item name="android:dialogTheme">@style/AppDialogTheme</item>
        <item name="android:alertDialogTheme">@style/AppAlertTheme</item>
    </style>
    
    <style name="AppDialogTheme" parent="android:Theme.Material.Dialog">
        <item name="android:colorPrimary">#FFFF4444</item>
        <item name="android:colorPrimaryDark">#FFCC0000</item>
        <item name="android:colorAccent">#FFFF00</item>
    </style>
    
    <!-- This should extend Theme.Material.Dialog.Alert, but that style was
         incorrectly hidden in L-preview. It will be fixed in a future release.
         You can approximate the style using the last two MinWidth attributes.-->
    <style name="AppAlertTheme" parent="android:Theme.Material.Dialog">
        <item name="android:colorPrimary">#FFFF4444</item>
        <item name="android:colorPrimaryDark">#FFCC0000</item>
        <item name="android:colorAccent">#FFFF00</item>
        <item name="android:windowMinWidthMajor">65%</item>
        <item name="android:windowMinWidthMinor">95%</item>
    </style>
    
    0 讨论(0)
提交回复
热议问题