0

all my layout are on top of my ActionBar. This seems like a very simple issue but I can't seem to figure it out.

enter image description here

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?android:attr/actionBarSize"
    android:fitsSystemWindows="true" >

    <TextView
        android:id="@+id/txtLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16dp"
        android:text="Home View"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true" />

    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/txtLabel"
        android:src="@drawable/ic_home"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:id="@+id/imageView" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:text="Logout"
        android:id="@+id/logout"
        android:textSize="13dp"
        android:textColor="#000000"
        android:layout_marginLeft="0dp"
        android:layout_below="@+id/imageView"
        android:layout_alignParentStart="true" />

</RelativeLayout>

Any ideas?

Thanks

DarkBee
  • 16,592
  • 6
  • 46
  • 58
Dan
  • 3
  • 3

2 Answers2

0

Check the windowActionBarOverlay option in the theme you're using. Might be set to true. https://developer.android.com/training/basics/actionbar/overlaying.html

imorsi
  • 346
  • 1
  • 11
  • In the themes.xml `windowActionBarOverlay` is set to false but does not works and even if i remove it. – Dan Dec 26 '14 at 11:14
0

Problem Solved :D I change my ActionBar to Toolbar https://stackoverflow.com/a/26700904/4394523 :

this is now my themes.xml

<resources>
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimary_dark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>

toolbar.xml

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:minHeight="?attr/actionBarSize"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=""
        android:textAppearance="@android:style/TextAppearance.Theme"
        android:textColor="@android:color/white" />
</android.support.v7.widget.Toolbar>

and put this in your layout:

android:layout_marginTop="?attr/actionBarSize"
Community
  • 1
  • 1
Dan
  • 3
  • 3