Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/319.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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
Java 操作栏背景显示在屏幕中间_Java_Android_Android Actionbar - Fatal编程技术网

Java 操作栏背景显示在屏幕中间

Java 操作栏背景显示在屏幕中间,java,android,android-actionbar,Java,Android,Android Actionbar,我已经更改了操作栏的背景,但它看起来是这样的: (我不能发布图片,因为我的声誉不超过10) 我有股票操作栏,我的操作栏背景显示在屏幕中间。我不知道怎样才能更好地描述它 你知道有什么问题吗 以下是my styles.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Base application theme, dependent on API level. This t

我已经更改了操作栏的背景,但它看起来是这样的:

(我不能发布图片,因为我的声誉不超过10)

我有股票操作栏,我的操作栏背景显示在屏幕中间。我不知道怎样才能更好地描述它

你知道有什么问题吗

以下是my styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.


    -->
    <style name="AppBaseTheme" parent="android:Theme.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.


        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

    <style name="ButtonBar">
        <item name="android:paddingLeft">2dp</item>
        <item name="android:paddingTop">5dp</item>
        <item name="android:paddingRight">2dp</item>
        <item name="android:paddingBottom">0dp</item>
        <item name="android:background">@android:drawable/bottom_bar</item>
    </style>

    <style name="ActionBar" parent="AppTheme">
        <item name="android:background">@drawable/action_bar</item>
    </style>

</resources>

2dp
5dp
2dp
0dp
@android:可绘制/底部工具栏
@可拉拔/动作杆
舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.geniboys.sosyaaal"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.geniboys.sosyaaal.loginActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.geniboys.sosyaaal.DisplayMessageActivity"
            android:label="@string/title_activity_display_message"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.geniboys.sosyaaal.SignUpActivity"
            android:label="@string/title_activity_sign_up"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.geniboys.sosyaaal.SignUp2"
            android:label="@string/title_activity_sign_up2"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.geniboys.sosyaaal.LogoActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/title_activity_logo"
            android:theme="@style/FullscreenTheme"
            android:screenOrientation="portrait" >
        </activity>
    </application>

</manifest>

以及layout.xml

<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="@drawable/loginbackground"
    tools:context=".loginActivity" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="22dp"
        android:layout_toLeftOf="@+id/textView1"
        android:text="@string/loginEmail"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#ffffff" />


    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView2"
        android:layout_marginTop="16dp"
        android:layout_toLeftOf="@+id/textView1"
        android:text="@string/loginSifre"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#ffffff" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textView2"
        android:layout_alignLeft="@+id/textView1"
        android:ems="10"
        android:inputType="textEmailAddress"
        android:text="@string/loginEmailhint"
        android:textColor="#ffffff" >

    </EditText>

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textView3"
        android:layout_alignLeft="@+id/editText1"
        android:ems="10"
        android:inputType="textPassword"
        android:textColor="#ffffff" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView3"
        android:layout_marginTop="26dp"
        android:layout_toRightOf="@+id/textView3"
        android:text="@string/loginGiris"
        android:textColor="#ffffff" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button1"
        android:layout_alignBottom="@+id/button1"
        android:layout_toRightOf="@+id/button1"
        android:onClick="kayitOl"
        android:text="@string/loginKayit"
        android:textColor="#ffffff" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/loginSenKimsin"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#ffffff" />

</RelativeLayout>

您的操作栏样式可能没有被使用,因为您的主题没有链接到它,操作栏样式的父级也应该更改:

将此添加到AppBaseTheme中:

  <item name="android:actionBarStyle">@style/ActionBar</item>
@style/ActionBar
将操作栏样式声明更改为:

  <style name="ActionBar" parent="android:Widget.ActionBar">


然后发布您的布局xml,我们将看看是否可以进一步帮助您

谢谢您的帮助,现在它不会显示在屏幕中间,但actionbar的背景不会改变。顺便说一句,你想让我发布哪种布局?无论哪个活动的布局显示了这种奇怪的行为,加上清单。不幸的是,我无法发现问题,它对我来说与你自己的设置非常相似。我使用parent=“Theme.AppCompat”作为我的AppTheme父对象。对不起,我帮不上忙了!感谢您的帮助问题可能与背景有关,actionbar背景的尺寸是多少?