<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" >
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/probardown">
<!-- 设置背景色图像资源 -->
<item android:id="@android:id/background" android:drawable="@drawable/grey" />
<!-- 设置第二级进度条颜色图像资源 -->
<item android:id="@android:id/secondaryProgress" android:drawable="@drawable/grey" />
<!-- 设置第一级进度条颜色图像资源 -->
<item android:id="@android:id/progress" android:drawable="@drawable/green" />
</layer-list>
是不是这个的原因?我用<selector></selector>就可以的。。汗
在哪里用<selector></selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#000" />
<item android:state_focused="true" android:color="#000" />
<item android:state_pressed="true" android:color="#000" />
<item android:color="#fff" />
</selector>
你改下试下。。应该是可以的
<!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background" >
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip >
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270"
/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ffffd300"
android:centerColor="#ffffb600"
android:centerY="0.75"
android:endColor="#ffffcb00"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>
这是我最后用的
源文件地址http://www.girlcoding.com/2011/04/custom-horizontal-progressbar/#comment-512
例如:
<item android:id="@android:id/background" >
<nine-patch android:src="@drawable/background"> </nine-patch>
</item>
<item android:id="@android:id/progress">
<clip>
<nine-patch android:src="@drawable/progress"> </nine-patch>
</clip>
</item>