Android Studio 0.4.5
用于创建自定义对话框的Android文档:http://developer.android.com/guide/topics/ui/dialogs.html
如果需要自定义对话框,则可以将"活动"显示为对话框,而不是使用"对话框API".只需创建一个活动并将其主题设置为<activity>清单元素中的Theme.Holo.Dialog :
<activity android:theme="@android:style/Theme.Holo.Dialog" >
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试这个时,我得到以下异常:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
Run Code Online (Sandbox Code Playgroud)
我支持以下内容,我不能使用大于10的内容:
minSdkVersion 10
targetSdkVersion 19
Run Code Online (Sandbox Code Playgroud)
在我的风格中,我有以下内容:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Run Code Online (Sandbox Code Playgroud)
在我的清单中,我有这个活动:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:theme="@android:style/Theme.Holo.Light.Dialog"
android:name="com.ssd.register.Dialog_update"
android:label="@string/title_activity_dialog_update" >
</activity>
Run Code Online (Sandbox Code Playgroud)
像我这样创建对话框是我要做的事情,因为我已经完成了布局.
谁能告诉我如何解决这个问题?
我得到在Android 2.3.5一个RuntimeException,但我正在用Theme.AppCompat(RES /价值/的themes.xml).这是电话:http://www.gsmarena.com/samsung_galaxy_y_s5360-4117.php
<!-- res/values/themes.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Styled" parent="@style/Theme.AppCompat">
<item name="actionBarStyle">@style/QueryActionBar</item>
<item name="android:actionBarStyle">@style/QueryActionBar</item>
</style>
<style name="QueryActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@color/blueback</item>
<item name="android:background">@color/blueback</item>
<item name="backgroundSplit">@color/blueback</item>
<item name="android:backgroundSplit">@color/blueback</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
这是values-v11的文件.
<!-- res/values-v11/themes.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="QueryTheme" parent="@android:style/Theme.Holo">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
这是错误.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.txt2lrn.www/com.txt2lrn.www.LandingActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with …Run Code Online (Sandbox Code Playgroud)