Changing progress bar color using XML in Android app

后端 未结 2 2102
孤独总比滥情好
孤独总比滥情好 2021-01-23 16:24

I\'m trying to change the color of a horizontal progress bar (foreground). I came across this example and am trying to model my XML file off it. However, I get a compiler erro

2条回答
  •  心在旅途
    2021-01-23 16:41

    The R class is generated by Android compiler, all fields of the inner class in R.java refer to the resources in res folder by android:id xml attribute. The Resouce class can retrieve the resource object by using the resource id. So, you can get Drawable object through Resource.getDrawable(int).

提交回复
热议问题