Android seekbar - no color tint parameters

心不动则不痛 提交于 2019-12-11 07:57:32

问题


See what's installed in the picture

Emulator is set to 4.4.2. MinSDK set to 16.

Error: No resource found that matches the given name: attr 'android:progressBackgroundTint' etc

Seekbar does not have the following parameters: colorControlActivated, progressbackgroundtint, progresstint, thumbtint

How to change color of seekbar?

Main.axml seekbar style:

<SeekBar
    p1:layout_width="250dp"
    p1:layout_height="wrap_content"
    ... />

Xamarin.Diagnostics

[I:sdk]:                    Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory found:
    Path contains adb in \platform-tools (path hidden by user\Android\android-sdk).
[I:sdk]:                    Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory found:
    Path contains ndk-stack in \. (path hidden by user\Microsoft\AndroidNDK64\android-ndk-r11c\).
[I:sdk]:                    Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory found:
    Path contains jarsigner.exe in \bin (path hidden by user\Java\jdk1.8.0_151).
[I:Unknown]:              Found Xamarin.Android 7.0.2
[I:Unknown]:              Found Android SDK. API levels: 17, 19
[I:]:                     Tracking android devices started
[D:]:                     Tracking avd started
[D:]:                     avd watcher *.ini path: 'path hidden by user\\.android\avd'
[D:]:                     avd watcher android path: 'path hidden by user\Android\ANDROI~1\tools\android.BAT'
[W:]:                     Adb connection refused
[I:]:                     Starting Adb server (adb start-server)
[I:]:                     Adb start-server operation completed
[D:]:                     TrackDeviceTask got: 
[I:]:                     Got new device list from adb with 0 devices
[D:]:                     avd watcher: got device list from avd with 1 devices

回答1:


How to change color of seekbar?

Android SeekBar custom material style, you could refer to :

http://www.zoftino.com/android-seekbar-and-custom-seekbar-examples

Create your custom SeekBar style :

<style name="MySeekBar" parent="Widget.AppCompat.SeekBar">
    <item name="android:progressBackgroundTint">#f4511e</item>
    <item name="android:progressTint">#388e3c</item>
    <item name="android:colorControlActivated">#c51162</item>
</style>

Use it in your axml :

<SeekBar
    android:id="@+id/mySeekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    style="@style/MySeekBar"
    />

Effect :

Update :

Please make sure you have add the xmlns:android="http://schemas.android.com/apk/res/android in your axml, if you have add this in your axml, please post your complete axml file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <SeekBar
        android:id="@+id/mySeekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/MySeekBar"
        />
</LinearLayout>


来源:https://stackoverflow.com/questions/47815424/android-seekbar-no-color-tint-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!