ActionBar是android 3.0之后才出的,也就是API 11及以上才有。

在minSdkVersion中填7的话,就会报错。

有一个办法可以解决。在使用ActionBar的activity属性上加android:theme="@android :style/Theme.Holo"就不会报错了。

示例AndroidManifest.xml文件如下:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.actionbartest"    android:versionCode="1"    android:versionName="1.0" >    <uses-sdk        android:minSdkVersion="7"        android:targetSdkVersion="17" />    <application        android:allowBackup="true"        android:icon="@drawable/ic_launcher"        android:label="@string/app_name"        android:theme="@style/AppTheme" >        <activity            android:name="com.example.actionbartest.MainActivity"            android:label="@string/app_name"             android:theme="@android:style/Theme.Holo"            >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>    </application></manifest>


更多相关文章

  1. Android ApiDemos示例解析(8):App->Activity->Hello world
  2. Android ApiDemos示例解析(136):Views->Layouts->Baseline->4. E
  3. Android基于ViewFilpper实现文字LED显示效果示例
  4. Android中使用ORMLite入门示例学习
  5. android本地后台服务示例
  6. Android 播放视频示例
  7. 在Android上实现HttpServer的示例代码

随机推荐

  1. 表单案例和css模块化与选择器
  2. html字体图标及盒模型练习
  3. php学习第四天
  4. HTML注册表单控件实例、CSS模块化理解与C
  5. 字体图标,布局与盒模型
  6. 酱茄OW,专为企业开发的官网小程序
  7. 测试使用的作业
  8. 注册表单实战案例
  9. 表单创建及CSS
  10. 字体图标的用法和布局的原则与元素