本文整理了Java中android.text.Layout.getLineBottom()
方法的一些代码示例,展示了Layout.getLineBottom()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.getLineBottom()
方法的具体详情如下:
包路径:android.text.Layout
类名称:Layout
方法名:getLineBottom
暂无
代码示例来源:origin: nickbutcher/plaid
int startRunBottom = startLayout.getLineBottom(currentStartLine);
int endRunRight = getRunRight(endLayout, endLayoutMaxLines, currentEndLine, i,
endLine, endMax, endMaxEllipsis, lastChar);
int endRunBottom = endLayout.getLineBottom(currentEndLine);
代码示例来源:origin: stackoverflow.com
private void appendTextAndScroll(String text)
{
if(mTextView != null){
mTextView.append(text + "\n");
final Layout layout = mTextView.getLayout();
if(layout != null){
int scrollDelta = layout.getLineBottom(mTextView.getLineCount() - 1)
- mTextView.getScrollY() - mTextView.getHeight();
if(scrollDelta > 0)
mTextView.scrollBy(0, scrollDelta);
}
}
}
代码示例来源:origin: stackoverflow.com
private void appendTextAndScroll(String text)
{
runOnUiThread(new Runnable()
{
public void run()
{
if(text.length() >= 1){
if(chat_text_chat != null){
chat_text_chat.append(text + "\n");
final Layout layout = chat_text_chat.getLayout();
if(layout != null){
int scrollDelta = layout.getLineBottom(chat_text_chat.getLineCount() - 1) - chat_text_chat.getScrollY() - chat_text_chat.getHeight();
if(scrollDelta > 0){
chat_text_chat.scrollBy(0, scrollDelta);
}
}
}
}
}
});
}
代码示例来源:origin: stackoverflow.com
mTextView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ViewTreeObserver obs = mTextView.getViewTreeObserver();
obs.removeOnGlobalLayoutListener(this);
int height = mTextView.getHeight();
int scrollY = mTextView.getScrollY();
Layout layout = mTextView.getLayout();
int firstVisibleLineNumber = layout.getLineForVertical(scrollY);
int lastVisibleLineNumber = layout.getLineForVertical(height + scrollY);
//check is latest line fully visible
if (mTextView.getHeight() < layout.getLineBottom(lastVisibleLineNumber)) {
// TODO you text is cut
}
}
});
代码示例来源:origin: stackoverflow.com
mTextView.setText(mText);
int height = mTextView.getHeight();
int scrollY = mTextView.getScrollY();
Layout layout = mTextView.getLayout();
int firstVisibleLineNumber = layout.getLineForVertical(scrollY);
int lastVisibleLineNumber = layout.getLineForVertical(height + scrollY);
//check is latest line fully visible
if (mTextView.getHeight() < layout.getLineBottom(lastVisibleLineNumber)) {
lastVisibleLineNumber--;
}
int start = pageStartSymbol + mTextView.getLayout().getLineStart(firstVisibleLineNumber);
int end = pageStartSymbol + mTextView.getLayout().getLineEnd(lastVisibleLineNumber);
String displayedText = mText.substring(start, end);
//correct visible text
mTextView.setText(displayedText);
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < lineNum; i++) {
Layout layout = textView.getLayout();
canvas.drawLine(layout.getLineLeft(i), layout.getLineBottom(i) - spacingExtra + offsetY,
layout.getLineRight(i), layout.getLineBottom(i) - spacingExtra + offsetY,
this.paint);
代码示例来源:origin: stackoverflow.com
int yEndCoordinateOfClickedText = textViewLayout.getLineBottom(clickedTextLine);
代码示例来源:origin: neopixl/PixlUI
/**
* Get how many lines of text we can display so their full height is visible.
*/
private int getFullyVisibleLinesCount() {
Layout layout = createWorkingLayout("");
int height = getHeight() - getPaddingTop() - getPaddingBottom();
int lineHeight = layout.getLineBottom(0);
return height / lineHeight;
}
代码示例来源:origin: stackoverflow.com
public void setCursorLocation(int characterOffset) {
Layout layout = this.getLayout();
int line = layout.getLineForOffset(characterOffset);
mCursorX = layout.getPrimaryHorizontal(characterOffset);
mCursorBaseY = layout.getLineBaseline(line);
mCursorBottomY = layout.getLineBottom(line);
mCursorAscentY = layout.getLineAscent(line);
this.invalidate();
}
代码示例来源:origin: hencoder/PracticeDraw5
@Override
protected void onDraw(Canvas canvas) {
Layout layout = getLayout();
bounds.left = layout.getLineLeft(1);
bounds.right = layout.getLineRight(1);
bounds.top = layout.getLineTop(1);
bounds.bottom = layout.getLineBottom(1);
canvas.drawRect(bounds, paint);
bounds.left = layout.getLineLeft(layout.getLineCount() - 4);
bounds.right = layout.getLineRight(layout.getLineCount() - 4);
bounds.top = layout.getLineTop(layout.getLineCount() - 4);
bounds.bottom = layout.getLineBottom(layout.getLineCount() - 4);
canvas.drawRect(bounds, paint);
super.onDraw(canvas);
}
}
代码示例来源:origin: redfish64/TinyTravelTracker
@Override
public void draw(Canvas canvas) {
final Layout layout = getLayout();
final RectF rect = mRect;
final int left = getCompoundPaddingLeft();
final int top = getExtendedPaddingTop();
rect.set(left + layout.getLineLeft(0) - PADDING_H,
top + layout.getLineTop(0) - PADDING_V,
Math.min(left + layout.getLineRight(0) + PADDING_H,
getScrollX() + getRight() - getLeft()),
top + layout.getLineBottom(0) + PADDING_V);
canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, mPaint);
super.draw(canvas);
}
}
代码示例来源:origin: hencoder/PracticeDraw5
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 把下面的绘制代码移到 super.onDraw() 的上面,就可以让原主体内容盖住你的绘制代码了
// (或者你也可以把 super.onDraw() 移到这段代码的下面)
Layout layout = getLayout();
bounds.left = layout.getLineLeft(1);
bounds.right = layout.getLineRight(1);
bounds.top = layout.getLineTop(1);
bounds.bottom = layout.getLineBottom(1);
canvas.drawRect(bounds, paint);
bounds.left = layout.getLineLeft(layout.getLineCount() - 3);
bounds.right = layout.getLineRight(layout.getLineCount() - 3);
bounds.top = layout.getLineTop(layout.getLineCount() - 3);
bounds.bottom = layout.getLineBottom(layout.getLineCount() - 3);
canvas.drawRect(bounds, paint);
}
}
代码示例来源:origin: chengzichen/KrGallery
textHeight = layout.getLineBottom(0);
if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.LEFT) {
offsetX = -(int) layout.getLineLeft(0);
代码示例来源:origin: MCMrARM/revolution-irc
private void showHandle(TextSelectionHandlePopup handle, long id, int offset) {
TextView textView = findTextViewByItemId(id);
if (textView != null) {
int line = textView.getLayout().getLineForOffset(offset);
int y = textView.getLayout().getLineBottom(line);
float x = textView.getLayout().getPrimaryHorizontal(offset);
handle.show(textView, (int) x, y);
} else {
handle.hide();
}
}
代码示例来源:origin: MCMrARM/revolution-irc
textViewEnd.getLocationOnScreen(mTmpLocation2);
outRect.bottom = mTmpLocation2[1] - mTmpLocation[1];
outRect.bottom += textViewStart.getLayout().getLineBottom(lineEnd);
代码示例来源:origin: cbeyls/fosdem-companion-android
touchedLineBounds.top = layout.getLineTop(line);
touchedLineBounds.right = layout.getLineWidth(line) + touchedLineBounds.left;
touchedLineBounds.bottom = layout.getLineBottom(line);
代码示例来源:origin: hylinux1024/Componentization
int bottom = layout.getLineBottom(line);
float eventY = event.getY() - this.getTotalPaddingTop();
代码示例来源:origin: tylersuehr7/social-text-view
touchBounds.top = layout.getLineTop(touchedLine);
touchBounds.right = layout.getLineRight(touchedLine);
touchBounds.bottom = layout.getLineBottom(touchedLine);
代码示例来源:origin: lltvcn/FreeText
drawer.draw(canvas,getPaint(),left,layout.getLineTop(line)+getPaddingTop(), right ,layout.getLineBottom(line)+getPaddingTop(),layout.getLineBaseline(line));
代码示例来源:origin: lltvcn/FreeText
right+=getPaddingLeft();
drawer.draw(canvas,getPaint(),left,layout.getLineTop(line)+getPaddingTop(), right ,layout.getLineBottom(line)+getPaddingTop(),layout.getLineBaseline(line));
内容来源于网络,如有侵权,请联系作者删除!