如何恢复对话和祝酒词的行为?

时间:2015-03-13 02:12:17

标签: android xml android-studio android-5.0-lollipop android-appcompat

我遇到以下问题:在AS崩溃后恢复我的VM暂停时,对话框和Toasts现在占据了整个屏幕。

之前,他们只是一个出现在屏幕底部的小盒子。现在,ProgressDialogs,对话框和Toast具有所有屏幕行为

我正在使用appcompat-21来使用Android Lollipop的工具栏控件。 我需要寻找什么?

Bellow the Manifest,主题和样式文件。

我已经删除了AS并在通过注册表清理应用程序后重新安装(我在Windows上)

Android Manifest:

<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright (C) 2008 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.zxing.client.android.ingresso"
    android:installLocation="auto"
    android:versionCode="109"
    android:versionName="@string/manifest_version">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="20" />

    <!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera.front"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera.flash"
        android:required="false" />
    <uses-feature android:name="android.hardware.screen.landscape" />
    <uses-feature
        android:name="android.hardware.wifi"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <!-- Donut-specific flags which allow us to run on any dpi screens. -->
    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />

<!--             android:screenOrientation="landscape" -->
    <application
        tools:replace="android:icon"
        android:name= "com.google.zxing.client.android.ingresso.App"
        android:icon="@drawable/launcher_icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:allowBackup="true" >
        <activity
            android:name=".LoginActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MenuActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="user"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity
            android:name=".BarcodeActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="landscape"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity
            android:name=".DataMatrixActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="landscape"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity android:name="net.hockeyapp.android.UpdateActivity" />
        <!--<activity-->
            <!--android:name=".ConfigurationActivity"-->
            <!--android:clearTaskOnLaunch="true"-->
            <!--android:configChanges="orientation|keyboardHidden"-->
            <!--android:screenOrientation="landscape"-->
            <!--android:stateNotNeeded="true"-->
            <!--android:theme="@android:style/Theme.NoTitleBar.Fullscreen"-->
            <!--android:windowSoftInputMode="stateAlwaysHidden" >-->
        <!--</activity>-->
        <activity
            android:name=".ManualActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity
            android:name=".SettingsActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="landscape"
            android:stateNotNeeded="true"
            android:windowSoftInputMode="stateAlwaysHidden" >
        </activity>
        <activity
            android:name=".LogonActivity"
            android:label="@string/title_activity_connect" >
        </activity>
    </application>

</manifest>

文件res / values / styles.xml:

    <?xml version="1.0" encoding="utf-8"?>
<resources  xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppTheme" parent="Theme.ScannerTheme">
        <item name="android:background">@drawable/bi_background</item>
    </style>

    <style name="textViewStyle"/>

    <style name="editTextStyle">
        <item name="android:color">#ff025358</item>
    </style>

    <style name="barcodeTextViewStyle">
        <item name="android:shadowColor">@android:color/darker_gray</item>
        <item name="android:shadowDx">-2</item>
        <item name="android:shadowDy">0</item>
        <item name="android:shadowRadius">2</item>
        <item name="android:textColor">#FFFFFF</item>
        <item name="android:textSize">23sp</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="barcodeCheckBoxStyle">
        <item name="android:shadowColor">@android:color/darker_gray</item>
        <item name="android:shadowDx">-2</item>
        <item name="android:shadowDy">0</item>
        <item name="android:shadowRadius">2</item>
        <item name="android:textColor">#FFFFFF</item>
        <item name="android:textSize">23sp</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="manualBarcodesbuttonStyle">
        <item name="android:padding">24dp</item>
    </style>

    <!-- Base application theme. -->

    <style name="buttonStyle" parent="AppTheme">
        <item name="android:background">@color/ingresso_btn</item>
    </style>

    <style name="base_activity">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:keepScreenOn">true</item>
        <item name="android:paddingBottom">@dimen/activity_vertical_margin</item>
        <item name="android:paddingLeft">@dimen/activity_horizontal_margin</item>
        <item name="android:paddingRight">@dimen/activity_horizontal_margin</item>
        <item name="android:paddingTop">@dimen/activity_vertical_margin</item>
        <item name="android:theme">@style/AppTheme</item>
        <item name="android:background">@drawable/bi_background</item>
    </style>

    <style name="logo_style">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_centerHorizontal">true</item>
        <item name="android:layout_alignParentTop">true</item>
        <item name="android:scaleType">fitXY</item>
        <item name="android:adjustViewBounds">true</item>
    </style>


</resources>

文件res / theme.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources  xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="Theme.ScannerTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Set AppCompat’s actionBarStyle -->


    <!-- The rest of your attributes -->
    </style>


</resources>

文件res / values-21 / styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppTheme" parent="Theme.ScannerTheme">
        <item name="android:background">@drawable/bi_background</item>
    </style>

</resources>

1 个答案:

答案 0 :(得分:0)

以下项目标记的可耻(但有教育意义):

<style name="AppTheme" parent="Theme.ScannerTheme">
    <item name="android:background">@drawable/bi_background</item>
</style>

是所有麻烦的原因,因为所有对话框因应用程序的主题而获得背景。

教训是:注意你在基本主题定义中的内容......