Skip to content

Commit 77a4795

Browse files
authored
set software mode will slow down performance (#20155)
1 parent 9ee9917 commit 77a4795

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxWebViewHelper.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,15 @@ public void run() {
127127
}
128128

129129
public static void setBackgroundTransparent(final int index) {
130-
if(android.os.Build.VERSION.SDK_INT >10) {
131-
sCocos2dxActivity.runOnUiThread(new Runnable() {
132-
@Override
133-
public void run() {
134-
Cocos2dxWebView webView = webViews.get(index);
135-
if (webView != null) {
136-
webView.setBackgroundColor(Color.TRANSPARENT);
137-
try {
138-
Method method = webView.getClass().getMethod("setLayerType",int.class,Paint.class);
139-
method.invoke(webView,WebView.LAYER_TYPE_SOFTWARE,null);
140-
} catch (Exception e) {
141-
e.printStackTrace();
142-
}
143-
}
130+
sCocos2dxActivity.runOnUiThread(new Runnable() {
131+
@Override
132+
public void run() {
133+
Cocos2dxWebView webView = webViews.get(index);
134+
if (webView != null) {
135+
webView.setBackgroundColor(Color.TRANSPARENT);
144136
}
145-
});
146-
}
137+
}
138+
});
147139
}
148140

149141
public static void setOpacityWebView(final int index, final float opacity) {

0 commit comments

Comments
 (0)