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)
像我这样创建对话框是我要做的事情,因为我已经完成了布局.
谁能告诉我如何解决这个问题?
我正在尝试实施Google几天前发布的新ActionBar支持库.在过去,我使用Google Developer's Support Library Setup页面上列出的相同方法成功实现了ActionBarSherlock,没有任何问题- 使用有关如何包含资源的指南(类似于ActionBarSherlock的工作方式).我将库项目作为库加载到我自己的项目中.
我可以告诉图书馆加载正常.当,而不是在我的MainActivity.java延伸活动,我改成了扩展ActionBarActivity(根据谷歌的说明),也不会出现错误 - 它正确导入.
我甚至尝试绕过style.xml文件并添加@style/Theme.AppCompat.Light到AndroidManifest.xml中两个直接<application>和<activity>具有android:theme="@style/ThemeAppCompat.Light"与导致同样的错误都尝试.
现在问题是我无法让它改变主题,更不用说甚至构建而不会抛出错误.下面是我收到的错误,后面是我更改为使用新主题的style.xml文件.
我有使用Android应用程序的适度经验,并且使用最新版本的支持库和使用API 18(Android 4.3)编译的SDK运行Eclipse.
构建期间收到错误
错误:检索项目的父项时出错:找不到与给定名称"@ style/Theme.AppCompat.Light"匹配的资源.styles.xml/ActBarTest/res/values line 3 Android AAPT问题
style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ProsoftStudio.ACTest" parent="@style/Theme.AppCompat.Light">
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
有什么建议?这从来都不是ActionBarSherlock的问题.我想继续使用这个新的支持库.几乎看起来.jar正在加载,但不是资源.
android android-theme android-actionbar android-actionbar-compat
我们刚刚将本地Android SDK更新到新版本22,我们也尝试更新我们的应用程序,但似乎是Android Studio布局设计视图中的SearchView渲染问题:每次设计师尝试渲染SearchView元素,它引发了一个异常:
Android.widget.SearchView的android.content.res.TypedArray.hasValueOrEmpty(TypedArray.java:845)中的java.lang.NullPointerException(SearchView.java:295).(SearchView.java:258)在android.widget.SearchView.(SearchView.java:254)java.lang.reflect.Constructor.newInstance(Constructor.java:422)在android.view.LayoutInflater.createView(LayoutInflater.java:607)的android.view .LayoutInflater.onCreateView(LayoutInflater.java:682)位于android.view.LayoutInflater中的android.view.LayoutInflater.RinoutInflater中的android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)中的android.view.LayoutInflater.DeCot LayoutInflater_Delegate.java:64)android.view.LayoutInflater.inflate(LayoutInflater.java:782),android.view.LayoutInflater.inflate(LayoutInflater.java:504),android.view.LayoutInflater.inflate(LayoutInflater.java:385) )
即使我们在新布局文件中从左侧工具栏创建新元素,也会出现这种情况.任何的想法?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SearchView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/searchView" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)