} else { int firstLineHeight = textLayout.getLineBottom(0) - textLayout.getLineTop(0); if (cueLine >= 0) { anchorPosition = Math.round(cueLine * firstLineHeight) + parentTop;
height = layout.getLineTop(i) + mHeight;
/** * Returns height of wheel item * * @return the item height */ private int getItemHeight() { if (itemHeight != 0) { return itemHeight; } else if (itemsLayout != null && itemsLayout.getLineCount() > 2) { itemHeight = itemsLayout.getLineTop(2) - itemsLayout.getLineTop(1); return itemHeight; } return getHeight() / visibleItems; }
/** * 返回滚轮item的高度 * @return the item height */ private int getItemHeight() { if (itemHeight != 0) { return itemHeight; } else if (itemsLayout != null && itemsLayout.getLineCount() > 2) { itemHeight = itemsLayout.getLineTop(2) - itemsLayout.getLineTop(1); return itemHeight; } return getHeight() / visibleItems; }
/** * Returns height of wheel item * * @return the item height */ private int getItemHeight() { if (itemHeight != 0) { return itemHeight; } else if (itemsLayout != null && itemsLayout.getLineCount() > 2) { itemHeight = itemsLayout.getLineTop(2) - itemsLayout.getLineTop(1); return itemHeight; } return getHeight() / visibleItems; }
/** * Returns height of wheel item * * @return the item height */ private int getItemHeight() { if (itemHeight != 0) { return itemHeight; } else if (itemsLayout != null && itemsLayout.getLineCount() > 2) { itemHeight = itemsLayout.getLineTop(2) - itemsLayout.getLineTop(1); return itemHeight; } return getHeight() / visibleItems; }
/** * Returns height of wheel item * * @return the item height */ private int getItemHeight() { if (itemHeight != 0) { return itemHeight; } else if (itemsLayout != null && itemsLayout.getLineCount() > 2) { itemHeight = itemsLayout.getLineTop(2) - itemsLayout.getLineTop(1); return itemHeight; } return getHeight() / visibleItems; }
/** * 画items * @param canvas the canvas for drawing */ private void drawItems(Canvas canvas) { canvas.save(); int top = itemsLayout.getLineTop(1); canvas.translate(0, - top + scrollingOffset); itemsPaint.setColor(ITEMS_TEXT_COLOR); itemsPaint.drawableState = getDrawableState(); itemsLayout.draw(canvas); canvas.restore(); }
/** * Draws items * * @param canvas the canvas for drawing */ private void drawItems(Canvas canvas) { canvas.save(); int top = itemsLayout.getLineTop(1); canvas.translate(0, -top + scrollingOffset); itemsPaint.setColor(ITEMS_TEXT_COLOR); itemsPaint.drawableState = getDrawableState(); itemsLayout.draw(canvas); canvas.restore(); }
/** * Draws items * * @param canvas * the canvas for drawing */ private void drawItems(Canvas canvas) { canvas.save(); int top = itemsLayout.getLineTop(1); canvas.translate(0, -top + scrollingOffset); itemsPaint.setColor(ITEMS_TEXT_COLOR); itemsPaint.drawableState = getDrawableState(); itemsLayout.draw(canvas); canvas.restore(); }
/** * Draws items * * @param canvas * the canvas for drawing */ private void drawItems(Canvas canvas) { canvas.save(); int top = itemsLayout.getLineTop(1); canvas.translate(0, -top + scrollingOffset); itemsPaint.setColor(ITEMS_TEXT_COLOR); itemsPaint.drawableState = getDrawableState(); itemsLayout.draw(canvas); canvas.restore(); }
/** * Draws items * * @param canvas * the canvas for drawing */ private void drawItems(Canvas canvas) { canvas.save(); int top = itemsLayout.getLineTop(1); canvas.translate(0, -top + scrollingOffset); itemsPaint.setColor(ITEMS_TEXT_COLOR); itemsPaint.drawableState = getDrawableState(); itemsLayout.draw(canvas); canvas.restore(); }
int lineHeight = sl.getLineBottom(0) - sl.getLineTop(0);// 比 tv_rotate_img_span.getLineHeight() 这个好 因为每行高刚度可能不一致
private void measureText(CharSequence text, Rect bounds) { StaticLayout tempLayout = new StaticLayout(text, getPaint(), Integer.MAX_VALUE, android.text.Layout.Alignment.ALIGN_NORMAL, 1f, 0f, false); bounds.left = (int) tempLayout.getLineLeft(0); bounds.right = (int) tempLayout.getLineRight(0); bounds.top = tempLayout.getLineTop(0); bounds.bottom = tempLayout.getLineBottom(0); }
private void measureText(CharSequence text, Rect bounds) { StaticLayout tempLayout = new StaticLayout(text, getPaint(), Integer.MAX_VALUE, android.text.Layout.Alignment.ALIGN_NORMAL, 1f, 0f, false); bounds.left = (int) tempLayout.getLineLeft(0); bounds.right = (int) tempLayout.getLineRight(0); bounds.top = tempLayout.getLineTop(0); bounds.bottom = tempLayout.getLineBottom(0); }
int startLine = 0; while(startLine < staticLayout.getLineCount()) { int startLineTop = staticLayout.getLineTop(startLine); int endLine = staticLayout.getLineForVertical(startLineTop + pageHeight); int endLineBottom = staticLayout.getLineBottom(endLine);
} else { int firstLineHeight = textLayout.getLineBottom(0) - textLayout.getLineTop(0); if (cueLine >= 0) { anchorPosition = Math.round(cueLine * firstLineHeight) + parentTop;
float previousBottom = layout.getLineTop(0); int lineCount = layout.getLineCount(); for (int i = 0; i < lineCount; i++) {
float previousBottom = layout.getLineTop(0); int lineCount = layout.getLineCount(); for (int i = 0; i < lineCount; i++) {
lineText.setEndIndex(end - 1); lineText.setText(text.substring(start, end)); lineText.setTopOffset(layout.getLineTop(index)); lineText.setBottomOffset(layout.getLineBottom(index)); lineText.setBaseLine(layout.getLineBaseline(index)+getPaddingTop());