本文整理了Java中android.graphics.Rect.toShortString
方法的一些代码示例,展示了Rect.toShortString
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rect.toShortString
方法的具体详情如下:
包路径:android.graphics.Rect
类名称:Rect
方法名:toShortString
[英]Return a string representation of the rectangle in a compact form.
[中]以紧凑的形式返回矩形的字符串表示形式。
代码示例来源:origin: stackoverflow.com
protected void onDraw(Canvas canvas){
final String s = "Hello. I'm some text!";
Paint p = new Paint();
Rect bounds = new Rect();
p.setTextSize(60);
p.getTextBounds(s, 0, s.length(), bounds);
float mt = p.measureText(s);
int bw = bounds.width();
Log.i("LCG", String.format(
"measureText %f, getTextBounds %d (%s)",
mt,
bw, bounds.toShortString())
);
bounds.offset(0, -bounds.top);
p.setStyle(Style.STROKE);
canvas.drawColor(0xff000080);
p.setColor(0xffff0000);
canvas.drawRect(bounds, p);
p.setColor(0xff00ff00);
canvas.drawText(s, 0, bounds.bottom, p);
}
代码示例来源:origin: LuckyJayce/LargeImage
} catch (Exception e) {
if (DEBUG)
Log.d(TAG, position.toString() + " " + clipImageRect.toShortString());
throwable = e;
e.printStackTrace();
代码示例来源:origin: KeepSafe/TapTargetView
"Text bounds: " + textBounds.toShortString() + "\n" +
"Target bounds: " + targetBounds.toShortString() + "\n" +
"Center: " + outerCircleCenter[0] + " " + outerCircleCenter[1] + "\n" +
"View size: " + getWidth() + " " + getHeight() + "\n" +
"Target bounds: " + targetBounds.toShortString();
代码示例来源:origin: elvishew/xLog
b.append("bnds=").append(mSourceBounds.toShortString());
代码示例来源:origin: com.harium.android/core
/**
* Return a string representation of the rectangle in a compact form.
*/
public String toShortString() {
return toShortString(new StringBuilder(32));
}
代码示例来源:origin: stackoverflow.com
protected void onDraw(Canvas canvas){
final String s = "Hello. I'm some text!";
Paint p = new Paint();
Rect bounds = new Rect();
p.setTextSize(60);
p.getTextBounds(s, 0, s.length(), bounds);
float mt = p.measureText(s);
int bw = bounds.width();
Log.i("LCG", String.format(
"measureText %f, getTextBounds %d (%s)",
mt,
bw, bounds.toShortString())
);
bounds.offset(0, -bounds.top);
p.setStyle(Style.STROKE);
canvas.drawColor(0xff000080);
p.setColor(0xffff0000);
canvas.drawRect(bounds, p);
p.setColor(0xff00ff00);
canvas.drawText(s, 0, bounds.bottom, p);
}
代码示例来源:origin: com.google.android.apps.common.testing.accessibility.framework/accessibility-test-framework
/**
* Returns a String description of the given {@link AccessibilityNodeInfo}. The default is to
* return the view's resource entry name.
*
* @param info the {@link AccessibilityNodeInfo} to describe
* @return a String description of the given {@link AccessibilityNodeInfo}
*/
public String describeInfo(AccessibilityNodeInfo info) {
StringBuilder message = new StringBuilder();
message.append("View ");
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
&& (info != null) && (info.getViewIdResourceName() != null)) {
message.append(info.getViewIdResourceName());
} else {
message.append("with bounds: ");
Rect bounds = new Rect();
info.getBoundsInScreen(bounds);
message.append(bounds.toShortString());
}
return message.toString();
}
}
代码示例来源:origin: Blankj/ALog
sb.append("bnds=").append(mSourceBounds.toShortString());
代码示例来源:origin: jbruchanov/AnUitor
@Override
protected HashMap<String, Object> fillValues(Drawable d, HashMap<String, Object> data, HashMap<String, Object> contextData) {
super.fillValues(d, data, contextData);
data.put("Bounds", d.getBounds().toShortString());
data.put("ChangingConfigurations", getBinaryString(d.getChangingConfigurations()));
data.put("IntrinsicWidth", d.getIntrinsicWidth());
data.put("CanApplyTheme", d.canApplyTheme());
data.put("ColorFilter", String.valueOf(d.getColorFilter()));
data.put("DirtyBounds", d.getDirtyBounds().toShortString());
代码示例来源:origin: henrichg/PhoneProfilesPlus
"Text bounds: " + textBounds.toShortString() + "\n" +
"Target bounds: " + targetBounds.toShortString() + "\n" +
"Center: " + outerCircleCenter[0] + " " + outerCircleCenter[1] + "\n" +
"View size: " + getWidth() + " " + getHeight() + "\n" +
"Target bounds: " + targetBounds.toShortString();
代码示例来源:origin: jbruchanov/AnUitor
data.put("HitRect", rect.toShortString());
代码示例来源:origin: Eaway/AppCrawler
sLastActionMessage = String.format("{Click} %s %s %s", text, clazz, bounds.toShortString());
else if (desc.length() > 0)
sLastActionMessage = String.format("{Click} %s %s %s", desc, clazz, bounds.toShortString());
else
sLastActionMessage = String.format("{Click} %s %s", clazz, bounds.toShortString());
代码示例来源:origin: appium/appium-espresso-driver
return Boolean.toString(viewElement.isVisible());
case BOUNDS:
return viewElement.getBounds().toShortString();
case RESOURCE_ID:
return viewElement.getResourceId();
代码示例来源:origin: xiaocong/android-uiautomator-server
serializer.attribute("", "selected", Boolean.toString(node.isSelected()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
serializer.attribute("", "bounds", getVisibleBoundsInScreen(node, width, height).toShortString());
代码示例来源:origin: appium/appium-espresso-driver
setAttribute(ViewAttributesEnum.SELECTED, viewElement.isSelected());
setAttribute(ViewAttributesEnum.VISIBLE, viewElement.isVisible());
setAttribute(ViewAttributesEnum.BOUNDS, viewElement.getBounds().toShortString());
final ViewText viewText = viewElement.getText();
if (viewText != null) {
内容来源于网络,如有侵权,请联系作者删除!