Android搜索栏 - 没有颜色色调参数

时间:2017-12-14 14:12:56

标签: android xamarin seekbar android-sdk-manager

查看图片中安装的内容

enter image description here

模拟器设置为4.4.2。 MinSDK设置为16。

错误:找不到与给定名称匹配的资源:attr'android:progressBackgroundTint'等

Seekbar没有以下参数:colorControlActivated,progressbackgroundtint,progresstint,thumbtint

如何更改搜索栏的颜色?

Main.axml 搜索栏样式:

<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 个答案:

答案 0 :(得分:1)

  

如何更改搜索栏的颜色?

Android SeekBar自定义素材样式,您可以参考:

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

创建自定义SeekBar样式:

<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>

axml

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

效果:

enter image description here

更新:

请确保在xmlns:android="http://schemas.android.com/apk/res/android添加了axml,如果您已在axml中添加,请发送完整的axml文件。

<?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>