android.widget.TextView.getLineBounds()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(317)

本文整理了Java中android.widget.TextView.getLineBounds()方法的一些代码示例,展示了TextView.getLineBounds()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.getLineBounds()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:getLineBounds

TextView.getLineBounds介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  TextView tv1 = (TextView)findViewById(R.id.textView);
  Rect rect = new Rect();
  int c = tv1.getLineCount();
  tv1.getLineBounds(0, rect);
  tv1.getLineBounds(1, rect);
  return true;
}

代码示例来源:origin: stackoverflow.com

TextView textView = new TextView(context);
textView.setText("foo bar");
int widthMeasureSpec = MeasureSpec.makeMeasureSpec(500, MeasureSpec.EXACTLY);
int heightMeasureSpec = MeasureSpec.makeMeasureSpec(500, MeasureSpec.AT_MOST);
textView.measure(widthMeasureSpec, heightMeasureSpec);
int lineBounds = textView.getLineBounds(0, null);

代码示例来源:origin: stackoverflow.com

TextView tv;
Rect rc=new Rect();
//...
for(int i=0; i < tv.getLineCount(); i++)
{
  tv.getLineBounds(line, rc);
  Log.v(TAG, "Line #"+i+", left="+rc.left+", right="+rc.right);
}

代码示例来源:origin: stackoverflow.com

int lineCount = tvTitle.getLineCount();
Rect bounds = new Rect();
tvTitle.getLineBounds(lineCount > 0 ? lineCount - 1 : 0, bounds);
FrameLayout.LayoutParams fllp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
fllp.gravity = (Gravity.BOTTOM | Gravity.RIGHT);

代码示例来源:origin: crvv/android_wubi_input

final Rect lineBoundsWithOffset = new Rect();
layout.getLineBounds(0, lineBoundsWithoutOffset);
textView.getLineBounds(0, lineBoundsWithOffset);
final float viewportToContentHorizontalOffset = lineBoundsWithOffset.left
    - lineBoundsWithoutOffset.left - textView.getScrollX();

相关文章

TextView类方法