小编kri*_*nlm的帖子

管成'adb shell`

为什么我不能管adb shell

[klm@kth ~]$ echo foo | adb shell cat
^C
Run Code Online (Sandbox Code Playgroud)

上面的命令挂起我的4.0.1模拟器,我没有看到预期的foo输出.

我认为这是因为adb shell它没有将stdin传递到它的子进程'stdout,并且cat坐着等待永远.这真的没有实现adb,或者我错过了什么?

android pipe adb

11
推荐指数
2
解决办法
9156
查看次数

如何在Canvas中找到当前的翻译位置?

如何从Canvas获取当前翻译位置?我正在尝试绘制我的坐标是相对(相互)和绝对(相对于画布)混合的东西.

让我们说我想做

canvas.translate(x1, y1);
canvas.drawSomething(0, 0); // will show up at (x1, y1), all good
// now i want to draw a point at x2,y2
canvas.translate(x2, y2);
canvas.drawSomething(0, 0); // will show up at (x1+x2, y1+y2)
// i could do
canvas.drawSomething(-x1, -y1);
// but i don't always know those coords
Run Code Online (Sandbox Code Playgroud)

这有效但很脏:

private static Point getCurrentTranslate(Canvas canvas) {
    float [] pos = new float [2];
    canvas.getMatrix().mapPoints(pos);
    return new Point((int)pos[0], (int)pos[1]);
}
...
Point p = getCurrentTranslate(canvas);
canvas.drawSomething(-p.x, -p.y);
Run Code Online (Sandbox Code Playgroud)

画布有一个getMatrix方法,它有一个setTranslate但没有 …

android canvas

8
推荐指数
1
解决办法
5596
查看次数

即使在屏幕外,也可以在没有移动点的情况下滚动Emacs

我想配置Emacs滚动我的缓冲区而不移动点,即使它离开了屏幕.在我当前的设置中,当我做(scroll-up 4)足够长的时间时,我的观点最终将被移动以使其保持在可见缓冲区内.

我想改变它,因为我idle-highlight会在符号中着色,我希望看到它的出现.当我滚动得足够远时,我的观点会在它离开屏幕并idle-highlight退回之前被移动.我怎么能改变这个?

我正在使用Emacs 24.

emacs scroll

6
推荐指数
1
解决办法
539
查看次数

标签 统计

android ×2

adb ×1

canvas ×1

emacs ×1

pipe ×1

scroll ×1