I was testing this code works but I need to locate in to her place. Like we do with addview.
B4X:
Sub Globals
Dim pb As ProgressBar
End Sub
Sub Activity_Create(FirstTime As Boolean)
pb.Initialize("pb")
Dim gd As GradientDrawable
gd.Initialize("TOP_BOTTOM", Array As Int(Colors.Blue, Colors.Red))
gd.CornerRadius = 3dip
SetProgressDrawable(pb, gd)
pb.Progress = 50
Activity.AddView(pb, 10dip, 10dip, 300dip, 50dip)
End Sub
Sub SetProgressDrawable(p As ProgressBar, drawable As Object)
Dim r As Reflector
Dim clipDrawable As Object
clipDrawable = r.CreateObject2("android.graphics.drawable.ClipDrawable", _
Array As Object(drawable, Gravity.LEFT, 1), _
Array As String("android.graphics.drawable.Drawable", "java.lang.int", "java.lang.int"))
r.Target = p
r.Target = r.RunMethod("getProgressDrawable") 'Gets the layerDrawable
r.RunMethod4("setDrawableByLayerId", _
Array As Object(r.GetStaticField("android.R$id", "progress"), clipDrawable), _
Array As String("java.lang.int", "android.graphics.drawable.Drawable"))
End Sub
[Code]
Thanks