UI走查 调整 滑动条参数
This commit is contained in:
@@ -50,6 +50,7 @@ public class SlidePanelView extends View {
|
||||
NORMAL_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_RIGHT, NORMAL_TEXT_MARGIN_RIGHT);
|
||||
SHORT_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_LEFT, SHORT_TEXT_MARGIN_LEFT);
|
||||
SHORT_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_RIGHT, SHORT_TEXT_MARGIN_RIGHT);
|
||||
SLIDEPANELVIEW_VIEW_HIGH = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SLIDEPANELVIEW_VIEW_HIGH, SLIDEPANELVIEW_VIEW_HIGH);
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -64,6 +65,7 @@ public class SlidePanelView extends View {
|
||||
private static int NORMAL_TEXT_MARGIN_RIGHT = 60;
|
||||
private static int SHORT_TEXT_MARGIN_LEFT = 60;
|
||||
private static int SHORT_TEXT_MARGIN_RIGHT = 70;
|
||||
private static int SLIDEPANELVIEW_VIEW_HIGH = 160;
|
||||
|
||||
private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
@@ -148,7 +150,8 @@ public class SlidePanelView extends View {
|
||||
// 高度根据图片大小和上下间隔确定
|
||||
textPaint.getTextBounds(blockText, 0, blockText.length(), textRect);
|
||||
widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width();
|
||||
heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
// heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
heightSize = SLIDEPANELVIEW_VIEW_HIGH;
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
}
|
||||
@@ -245,7 +248,7 @@ public class SlidePanelView extends View {
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
// 画背景
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2, (float) getHeight() / 2, bgPaint);
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2, SLIDEPANELVIEW_VIEW_HIGH / 2, bgPaint);
|
||||
// 画文字
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<attr name="NORMAL_TEXT_MARGIN_RIGHT" format="dimension" />
|
||||
<attr name="SHORT_TEXT_MARGIN_LEFT" format="dimension" />
|
||||
<attr name="SHORT_TEXT_MARGIN_RIGHT" format="dimension" />
|
||||
<attr name="SLIDEPANELVIEW_VIEW_HIGH" format="dimension" />
|
||||
<attr name="BLOCK_START_X" format="dimension" />
|
||||
<attr name="BLOCK_START_Y" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
Reference in New Issue
Block a user