Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在actionBar顶部发布Android布局_Android_Android Layout_Android Actionbar - Fatal编程技术网

在actionBar顶部发布Android布局

在actionBar顶部发布Android布局,android,android-layout,android-actionbar,Android,Android Layout,Android Actionbar,我所有的布局都在我的操作栏上。这似乎是一个非常简单的问题,但我似乎无法解决它 <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"

我所有的布局都在我的操作栏上。这似乎是一个非常简单的问题,但我似乎无法解决它

<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>


有什么想法吗


谢谢

检查您正在使用的主题中的
窗口操作BarOverlay
选项。可能设置为true

问题已解决:D我将操作栏更改为工具栏:

这是我的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>

android:fitsystemwindows=“true”您可以删除它吗?我删除了它,但没有任何更改…在themes.xml
windowActionBarOverlay
设置为false,但不起作用,即使我删除了它。
<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>
android:layout_marginTop="?attr/actionBarSize"