本文整理汇总了Java中android.support.test.uiautomator.UiDevice.getDisplayHeight方法的典型用法代码示例。如果您正苦于以下问题:Java UiDevice.getDisplayHeight方法的具体用法?Java UiDevice.getDisplayHeight怎么用?Java UiDevice.getDisplayHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.uiautomator.UiDevice
的用法示例。
在下文中一共展示了UiDevice.getDisplayHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
@Override
public NanoHTTPD.Response get(RouterNanoHTTPD.UriResource uriResource, Map<String, String> urlParams, NanoHTTPD.IHTTPSession session) {
String sessionId = urlParams.get("sessionId");
try {
UiDevice mDevice = Elements.getGlobal().getmDevice();
Integer width = mDevice.getDisplayWidth();
Integer height = mDevice.getDisplayHeight();
JSONObject size = new JSONObject();
size.put("width", width);
size.put("height", height);
return NanoHTTPD.newFixedLengthResponse(getStatus(), getMimeType(), new Response(size, sessionId).toString());
} catch(Exception e) {
return NanoHTTPD.newFixedLengthResponse(getStatus(), getMimeType(), new Response(Status.UnknownError, sessionId).toString());
}
}
示例2: getDeviceAbsPos
import android.support.test.uiautomator.UiDevice; //导入方法依赖的package包/类
public static Point getDeviceAbsPos(final Point point)
throws UiObjectNotFoundException, InvalidCoordinatesException {
final UiDevice d = UiDevice.getInstance();
final Rect displayRect = new Rect(0, 0, d.getDisplayWidth(), d.getDisplayHeight());
Logger.debug("Display bounds: " + displayRect.toShortString());
return getAbsolutePosition(point, displayRect, new Point(), true);
}