<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="0dip" />
<gradient
android:angle="0"
android:endColor="#36A19C"
android:startColor="#36A19C" />
</shape>
</clip>
</item>
를 사용하여 진행률 표시 줄의 색상을 설정하고있어에서
3
안드로이드
A
답변
4
에 custom_progressbar.xml
을 파일을 생성하여 당김
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="backgroundColor"
android:endColor="backgroundColor"
android:angle="0"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="progressColor"
android:endColor="progressColor"
android:angle="0"
/>
</shape>
</clip>
</item>
</layer-list>
는
// Get the Drawable custom_progressbar
Drawable customDrawable= res.getDrawable(R.drawable.custom_progressbar);
// set the drawable as progress drawavle
progressBar.setProgressDrawable(customDrawable);
2
당신은이 방법으로 시도 할 수있는 코드에서의 ProgressBar로 설정 :
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<solid android:color="@color/seekbar_background" />
<stroke
android:width="@dimen/seekbar_background_border"
android:color="@android:color/transparent" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/seekbar_progress" />
</shape>
</clip>
</item>
</layer-list>
진행 표시 줄을 여러 레이어를 보유하는 레이어 목록을 사용합니다. 에스. 배경이이고 진행이 필요합니다. 희망이 당신을 도와줍니다 :)
0
이 코드 줄을 진행률 표시 줄 XML에 추가하십시오.
android:progressBackgroundTint="#ReplaceThisWithYourColor"
저에게 적합합니다.
고마워요 ... 성공했습니다 ... – prince
왜 진도 표시기 높이가 그렇게 커지나요? 그것을 더 짧게 만드는 방법? –