android - How can I set progress bar color accent programmatically? -
i'm creating progressdialog compatible appcompat. color accent not applied in created progressbar.
link source of progressdialogcompat: https://github.com/krystian71115/androidhelperlibrary/blob/master/src/com/krystian71115/android/app/progressdialogcompat.java#l160
the result:
in screenshot can see progress bar in main layout applied correctly. when create programmatically doesn't work.
second screenshot after close dialog:
the coloraccent working correctly not working when create progress bar programmaticaly.
oncreate method:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); progressdialogcompat dialog = new progressdialogcompat(this); dialog.settitle("loading"); dialog.setmessage("loading data..."); dialog.setprogressstyle(progressdialogcompat.style_horizontal); dialog.setprogress(150); dialog.setmax(300); dialog.show(); }
how can create progressbar horizontal coloraccent?
style:
<style name="apptheme" parent="theme.appcompat.light"> <item name="coloraccent">@color/red</item> </style>
i'm using appcompat.
i'm testing on api 22 (emulator).
Comments
Post a Comment