WebView Horizontal orientation

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

WebView Horizontal orientation

Postby xoise » Sun Dec 14, 2008 6:14 pm

I've been searching this tons with no help. My application uses a
WebView and I'd like to make this default to horizontal orientation.

I've tried changing this with the layout main.xml file (confused about
that) and also with the WebSettings.setUseWideViewPort() and neither
makes any difference. What am I doing wrong?

Mancala.java class:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Mancala extends Activity {
  2.  
  3.    @Override
  4.  
  5.    public void onCreate(Bundle savedInstanceState) {
  6.  
  7.        super.onCreate(savedInstanceState);
  8.  
  9.        WebView wv = new WebView(this);
  10.  
  11.        setContentView(wv);
  12.  
  13.        WebSettings ws = wv.getSettings();
  14.  
  15.        ws.setUseWideViewPort(true);
  16.  
  17.        ws.setJavaScriptEnabled(true);
  18.  
  19.        wv.loadUrl("file:///android_asset/mancala.html");
  20.  
  21.    }
  22.  
  23. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


main.xml:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <WebView xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.  android:layout_width="fill_parent"
  6.  
  7.  android:layout_height="fill_parent"
  8.  
  9.  android:orientation="horizontal"
  10.  
  11.  />
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
xoise
Freshman
Freshman
 
Posts: 7
Joined: Sun Dec 14, 2008 6:13 pm

Top

Postby MrSnowflake » Sun Dec 14, 2008 7:41 pm

What do you mean horizontal? You mean have the whole Activity be horizontal? This should be done in the Manifest, or you can use Activity.setRequestedOrientation()
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby xoise » Sun Dec 14, 2008 7:54 pm

MrSnowflake wrote:What do you mean horizontal? You mean have the whole Activity be horizontal? This should be done in the Manifest, or you can use Activity.setRequestedOrientation()

setRequestedOrientation() did it! Thanks a ton!
xoise
Freshman
Freshman
 
Posts: 7
Joined: Sun Dec 14, 2008 6:13 pm

Postby MrSnowflake » Sun Dec 14, 2008 9:26 pm

np.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests