0

I'm trying to style some programmatically created progressbars. I have some .xml made ones in which i use this style.

style="@android:style/Widget.DeviceDefault.ProgressBar.Large"

I'm trying but I can't figure out how to use this particular style for the programmatically made ones. I have been trying with this one:

android.R.attr.progressBarStyleLarge

Edit:Currently I'm trying

ArrayList<ProgressBar> progressArrayList = new ArrayList<>();
progressArrayList.add(new ProgressBar(getContext(), null ,android.R.style.Widget_DeviceDefault_ProgressBar_Large));

but they dissapear when I use the style like that.

dec0yable
  • 87
  • 13
  • Take a look at [this](http://stackoverflow.com/questions/11723881/android-set-view-style-programatically) thread, it should clear things up. – Ruben2112 Apr 04 '16 at 14:42
  • So if i understand correctly you can use styles outside of attr if you create them in your styles recource file? How can i do this for the DeviceDefault ProgressBar? – dec0yable Apr 05 '16 at 06:08

1 Answers1

1

I figured it out with Ruben2112's link with the answer in this post android set style in code

progressArrayList.add((ProgressBar)getActivity().getLayoutInflater().inflate(R.layout.progresspagestyle, null));

progresspagestyle is an xml in the res/layout folder.

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar
    style="@android:style/Widget.DeviceDefault.ProgressBar.Large"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android" />
Community
  • 1
  • 1
dec0yable
  • 87
  • 13