• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

WebView position wrong with hardware acceleration

akoka

Lurker
One might think that this is a bug unless somebody has a better explanation. When I turn hardware acceleration off, I'm able to position the webView using the setX and setY methods and it works great but it seems like setX and setY have no effect when hardware acceleration is on and the webView seems to always render at 0,0. Following is a little snippet of code which can be used to re-create the problem easily.

Any help is appreciated. Thanks.

Code:
[LIST=1]
[*]// Create layout  
[*]            RelativeLayout layout = new RelativeLayout(this);  
[*]            setContentView(layout);  
[*]              
[*]            // Create area  
[*]            FrameLayout area = new FrameLayout(this);  
[*]            area.setX(500);  
[*]            area.setY(100);  
[*]              
[*]            // Add area to view  
[*]            layout.addView(area, 640, 480);  
[*]              
[*]            WebView wv = new WebView(this);  
[*]            wv.getSettings().setJavaScriptEnabled(true);  
[*]            wv.getSettings().setPluginsEnabled(true);  
[*]            wv.getSettings().setAllowFileAccess(true);  
[*]            wv.loadUrl("someURL");  
[*]            area.addView(wv, 640, 480);
[/LIST]
 
Back
Top Bottom