ProgressBar水平进度条的颜色设置
2013-10-25 17:34
579 查看
1、在drawable目录下新建XML文件progressbar_horizontal_red:
[java] view
plaincopy
<?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">
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#ff333333"
android:centerColor="#ff4a4a4a" android:centerY="0.75"
android:endColor="#ff333333" android:angle="270" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#8000AADD"
android:centerColor="#8000AADD" android:centerY="0.75"
android:endColor="#8000AADD" android:angle="270" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#fffa6b6b"
android:centerColor="#ffff0000" android:centerY="0.75"
android:endColor="#ffe80202" android:angle="270" />
</shape>
</clip>
</item>
</layer-list>
2、在values目录下新建XML文件styles:
[java] view
plaincopy
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="progressbarStyle_Horizontal_Red" parent="android:Widget.ProgressBar.Horizontal">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/progressbar_horizontal_red</item>
<item name="android:minHeight">12.0dp</item>
<item name="android:maxHeight">12.0dp</item>
</style>
</resources>
3、布局文件代码:
[java] view
plaincopy
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/progressbarStyle_Horizontal_Red" />
[java] view
plaincopy
<?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">
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#ff333333"
android:centerColor="#ff4a4a4a" android:centerY="0.75"
android:endColor="#ff333333" android:angle="270" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#8000AADD"
android:centerColor="#8000AADD" android:centerY="0.75"
android:endColor="#8000AADD" android:angle="270" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#fffa6b6b"
android:centerColor="#ffff0000" android:centerY="0.75"
android:endColor="#ffe80202" android:angle="270" />
</shape>
</clip>
</item>
</layer-list>
2、在values目录下新建XML文件styles:
[java] view
plaincopy
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="progressbarStyle_Horizontal_Red" parent="android:Widget.ProgressBar.Horizontal">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/progressbar_horizontal_red</item>
<item name="android:minHeight">12.0dp</item>
<item name="android:maxHeight">12.0dp</item>
</style>
</resources>
3、布局文件代码:
[java] view
plaincopy
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/progressbarStyle_Horizontal_Red" />
相关文章推荐
- 安卓ProgressBar水平进度条的颜色设置
- ProgressBar水平进度条的颜色设置
- 安卓ProgressBar水平进度条的颜色设置
- android ProgressBar水平进度条的颜色设置
- 安卓ProgressBar水平进度条的颜色设置
- Android学习札记7:ProgressBar水平进度条的颜色设置
- 安卓学习笔记---ProgressBar水平进度条的颜色设置
- Android进度条ProgressBar颜色的渐变设置
- Flex中如何设置进度条(ProgressBar)边框颜色的例子
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 为ProgressBar进度条设置颜色1
- 不确定(indeterminateProgressBar)进度条的颜色设置
- progressBar相关 更改默认颜色 以及水平颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 不确定(indeterminateProgressBar)进度条的颜色设置
- 设置progressbar进度条颜色
- 不确定(indeterminateProgressBar)进度条的颜色设置