Layout 'moves down' when a key on the D-Pad is pressed.

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

Layout 'moves down' when a key on the D-Pad is pressed.

Postby its_neil » Tue Jun 30, 2009 2:17 pm

Hey guys, got a bit of a problem that I can't really seem to google as it's hard to explain.

My app is basically a webview, with a FooterView (my own View) and another (AdMob) view below it. I've disabled the title bar and used FLAG_FULLSCREEN so I get the whole 480px height.

My problem is that everything is aligned nicely on the screen until I press up or down on the Dpad, the orange highlight jumps to the first webview (totally fine), but the entire screen shifts DOWN as if everything was being drawn below a title bar (which isn't there) - however if i remove FEATURE_NO_TITLE and use the app then the problem goes away.

Things I've tried include swallowing keypresses (to no avail), different Layouts (again, to no avail), blank views to 'prop up' the webview (again nothing).

If I remove the main WebView from the screen (and leave just a blank space w/ footer and ad) - the problem goes away.

Here is the XML: -

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4.  
  5.  
  6. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  7.  
  8.         xmlns:app="http://schemas.android.com/apk/res/brightai.console"
  9.  
  10.  
  11.  
  12.    android:orientation="vertical"
  13.  
  14.    android:layout_width="fill_parent"
  15.  
  16.    android:layout_height="fill_parent"
  17.  
  18.    >
  19.  
  20.      
  21.  
  22.     <WebView
  23.  
  24.                 android:id="@+id/webby"
  25.  
  26.                 android:screenOrientation="portrait"
  27.  
  28.             android:layout_width="fill_parent"
  29.  
  30.             android:layout_height="393px"  
  31.  
  32.             android:focusable="false"
  33.  
  34.             android:background="#ff000000"
  35.  
  36.             android:fitsSystemWindows="false"
  37.  
  38.             android:layout_alignParentTop="true"
  39.  
  40.            
  41.  
  42.    />
  43.  
  44.      
  45.  
  46.         <com.admob.android.ads.AdView  
  47.  
  48.                   android:id="@+id/web_ad"
  49.  
  50.                   android:visibility="visible"
  51.  
  52.                   android:layout_width="fill_parent"
  53.  
  54.                   android:layout_height="48px"
  55.  
  56.                   app:backgroundColor="#000000"
  57.  
  58.                   app:textColor="#FFFFFF"
  59.  
  60.                   app:keywords="Android game"
  61.  
  62.                   app:testing = "true"
  63.  
  64.                   android:layout_alignParentBottom="true"
  65.  
  66.          />
  67.  
  68.          
  69.  
  70.         <neil.FooterView
  71.  
  72.                 android:id="@+id/footer"
  73.  
  74.                 android:screenOrientation="portrait"
  75.  
  76.             android:layout_width="fill_parent"
  77.  
  78.             android:layout_height="60px"    
  79.  
  80.             android:layout_above="@id/web_ad"
  81.  
  82.    />
  83.  
  84.                
  85.  
  86.  
  87.  
  88.  
  89.  
  90. </RelativeLayout>
  91.  
  92.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


Another bizarre thing is if I set the height of the first webview to 'fill_parent' and align it to parent_bottom, then the problem goes away, but I lose half the webview behind the footer and ad, so no good :/

Anyone able to help?

Thx!

EDIT:

Here is what I mean, a couple of screenshots from the emulator. (the little arrow is another view, but the behaviour is the same with or without it)

Image
its_neil
Freshman
Freshman
 
Posts: 4
Joined: Tue Jun 30, 2009 2:11 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests