Skip to content

Commit

Permalink
修改报表的大小参数
Browse files Browse the repository at this point in the history
  • Loading branch information
uni7corn committed Sep 13, 2017
1 parent 3951d91 commit 95f205c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,10 @@ private void drawCoordinate(Canvas canvas) {

for (int i = 0; i < 4; i++) {
canvas.drawText(labelText[i], getPaddingLeft(), itemHeight * (1.5f + i) + (textBounds.height() >> 1), textPaint);
if (i == 3) {
coordinatePaint.setColor(getResources().getColor(R.color.white));
}
canvas.drawPath(soberPath, coordinatePaint);
soberPath.reset();
soberPath.moveTo(getPaddingLeft(), (2 + i) * itemHeight);
soberPath.lineTo(getWidth() - getPaddingRight(), (2 + i) * itemHeight);
canvas.drawPath(soberPath, coordinatePaint);
}
}

Expand All @@ -267,14 +264,14 @@ private int measureHeight(int heightMeasureSpec) {
int size = MeasureSpec.getSize(heightMeasureSpec);
switch (MeasureSpec.getMode(heightMeasureSpec)) {
case MeasureSpec.EXACTLY://match_parent 或者指定的大小
int i = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280.0f, getResources().getDisplayMetrics());
int i = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200.0f, getResources().getDisplayMetrics());
return Math.max(i, size);
case MeasureSpec.AT_MOST:// wrap_content
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280.0f, getResources().getDisplayMetrics());
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200.0f, getResources().getDisplayMetrics());
case MeasureSpec.UNSPECIFIED:
break;
}
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280.0f, getResources().getDisplayMetrics());
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200.0f, getResources().getDisplayMetrics());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main_sleep.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.szzh.audio.newviewpager.histogram.WeekSleepHistogramView
<com.szzh.audio.newviewpager.histogram.DaySleepHistogramView
android:id="@+id/sleepy_data_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit 95f205c

Please sign in to comment.