如何设置宽度和高度CircularProgress?

时间:2017-02-15 11:53:38

标签: android layout

我想设置我的CircularProgress'w:300dip h:300dip。但我无法改变它。有什么想法吗?

MyClass.java

RelativeLayout relativeLayout = new RelativeLayout(mContext);
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            300,300);
    lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.setMargins(0,0,0,76);
    relativeLayout.setLayoutParams(lp);
    TextView textView = new TextView(relativeLayout.getContext());
    textView.setText(modelObject);
    relativeLayout.addView(textView);
    CircularProgressBar c3=new     CircularProgressBar(relativeLayout.getContext());
    relativeLayout.addView(c3);
    c3.setTitle(String.valueOf(yuzdeler[position]));
    c3.setSubTitle("GÜN KALDI");
    c3.setProgress(yuzdeler[position]);
    c3.setLayoutParams(lp);
    collection.addView(relativeLayout);
    return relativeLayout;

screen

2 个答案:

答案 0 :(得分:1)

将布局参数的高度和宽度设置为CircularProgressBar

RelativeLayout.LayoutParams circularLp = new RelativeLayout.LayoutParams(
            50,50);
c3.setLayoutParams(circularLp);

答案 1 :(得分:0)

从xml:

更改它
<com.lylc.widget.circularprogressbar.example.CircularProgressBar
    android:id="@+id/circularprogressbar1"
    style="@style/Widget.ProgressBar.Holo.CircularProgressBar"
    android:layout_width="300dip"
    android:layout_height="300dip"
    android:layout_marginTop="10dip"
    circular:subtitle="subtitle"
    circular:title="Title" />