1

I want to have webview displayed fullscreen with action bar on top of it and standard menu bar on bottom. It's displayed correctly without action bar. When I am turning it on, bottom part of webview is displayed under bottom menu bar and I want to fit it between both menu bars. Its probably easy fix but can't find answer on that. Thanks!

Code:

main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >


    <WebView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layerType="software"
       />

</RelativeLayout>

settings.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:id="@+id/group1">
        <item android:id="@+id/opt" android:android:showAsAction="ifRoom|withText" android:enabled="true" android:title="Option 1" android:visible="true"></item>
        <item android:id="@+id/opt2" android:showAsAction="ifRoom|withText" android:enabled="true" android:title="Option 2" android:visible="true"></item>

    </group>

</menu>

activity:

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.settings, menu);
    this.menu = menu;




    getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    return true;
}
Piotr
  • 1,743
  • 1
  • 26
  • 40

2 Answers2

2

android:windowActionBarOverlay Declares whether the action bar should overlay the activity layout rather than offset the activity's layout position This is false by default.

When overlay mode is enabled, your activity layout has no awareness of the action bar laying on top of it.

More about Actionbars can be read here: http://developer.android.com/guide/topics/ui/actionbar.html

DoDu
  • 44
  • 2
  • It should be false. I want actionbar to displace my view and set&fit them directly between action bar and bottom bar - is it possible? – Piotr Dec 21 '11 at 12:49
  • 1
    @Piotr as far as I know, you're looking for the split action Bar, which is only available for devices running on Android 4.0. Otherwise A.Quiroga is right – DoDu Dec 21 '11 at 12:58
  • Gosh, thats bummer. So is it possible to move action bar items back to bottom bar? – Piotr Dec 21 '11 at 13:03
  • I'm sorry, but this I can't answer... I haven't read anything in the documentation about moving it to the bottom (I just looked again...). You can either try to find some info about this or go with A.Quiroga's method. – DoDu Dec 21 '11 at 13:15
1

Use Relative Layout in order to fit things in the right way.

Show us more code in order to obtain for a better answer :D

MOD

Options menu is not made usually for fit into your layout , but overlapping it . I tell you to consider creating a fixed real menu which hides whenever you want with some action.

Also think that menu can't have a fixed size and it may change with orientation , mobile phone , android version . Then if you could made what you need , you'll have more problems with your layout than making a custom one.

A.Quiroga
  • 5,704
  • 6
  • 37
  • 58