Closed trant closed 9 years ago
I see this too. Have you figured out why? Ill try to look at it myself.
I had to make the calculations programatically for achieving that
Want to share your code?
On Tue, Apr 15, 2014 at 11:26 AM, Antonio notifications@github.com wrote:
I had to make the calculations programatically for achieving that
— Reply to this email directly or view it on GitHubhttps://github.com/Todd-Davies/ProgressWheel/issues/24#issuecomment-40495389 .
private void updateProgressWheelLayoutParameters(ProgressWheel progressWheel) {
if (getActivity() == null)
return;
Display display = getActivity().getWindowManager().getDefaultDisplay();
@SuppressWarnings("deprecation")
int width = display.getWidth();
@SuppressWarnings("deprecation")
int height = display.getHeight();
Resources resources = getResources();
int progressWheelSize = (width > height ? height / 2 : width / 2) - (int) resources.getDimension(R.dimen.dial_margins);
progressWheel.setRimWidth((int) resources.getDimension(R.dimen.dial_rim_width));
progressWheel.setBarWidth((int) resources.getDimension(R.dimen.dial_bar_width));
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(progressWheelSize, progressWheelSize);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
params.addRule(RelativeLayout.BELOW, R.id.dialTitleTextView);
int marginTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, resources.getDisplayMetrics());
params.setMargins(0, marginTop, 0, 0);
progressWheel.setLayoutParams(params);
}
This is not the best solution still
I discovered the problem...in setupBounds, the call to this.getLayoutParams().width and this.getLayoutParams().height return -1 when the layout_[width|height] parameter is set to match_parent. This throw the rest of the calculations off. I look to fix this.
I just submitted a proper fix as a pull request to this issue.
The ProgressWheel control does not draw when I specify it as :
<com.todddavies.components.progressbar.ProgressWheel android:id="@+id/dialProgressWheel" android:layout_width="match_parent" android:layout_height="match_parent" ProgressWheel:barColor="#FF0000" ProgressWheel:barLength="5dp" ProgressWheel:barWidth="5dp" ProgressWheel:rimColor="#000000" ProgressWheel:rimWidth="10dp" ProgressWheel:text="" ProgressWheel:textColor="#222" ProgressWheel:textSize="14sp" />