我正在開發面向android Wear的Watch Face。我想讓Canvas硬件加速。如何在CanvasWatchFaceService的onDraw()中獲取硬件加速Canvas?
在清單中,我宣佈它像波紋管
<application
android:hardwareAccelerated="true"
..>
<service
android:name=".WatchFaceMain"
android:hardwareAccelerated="true"
..>
</application>
但是,當我從我的onDraw內檢查的話(帆布油畫,矩形邊界)方法canvas.isHardwareAccelerated()返回false。這顯然意味着我的畫布不是硬件加速的。
@Override
public void onDraw(Canvas canvas, Rect bounds) {
...
boolean isAccelarated = canvas.isHardwareAccelerated();
.......
}
如何使此畫布硬件加速?