错误描述为:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

起因:
我想在Manifest中设置我的activity全屏,代码如下:

        <activity
android:name=".MainActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name" >

原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了ActionBarActivity,它来自android.support.v7.app.ActionBarActivity。
所以就要使用与其配合的AppCompat的theme才行。

解决:
1.根据提示来使用AppCompat的theme,如下:

        <activity
android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:label="@string/app_name" >

http://blog.csdn.net/lincyang/article/details/42673151

2.如果不是那么强烈需要继承自ActionBarActivity,就直接继承Activity吧。问题自然搞定!

Android You need to use a Theme.AppCompat theme (or descendant) with this activity.的更多相关文章

  1. Android Studio:You need to use a Theme.AppCompat theme (or descendant) with this activity. AlertDialog

    学习<第一行代码>的时候遇到的问题. Process: com.example.sevenun.littledemo, PID: 2085 java.lang.RuntimeExcepti ...

  2. Android Studio: You need to use a Theme.AppCompat theme (or descendant) with this activity.

    错误描述为: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with ...

  3. Android:真机调试遇到的问题(You need to use a Theme.AppCompat theme (or descendant) with this activity)

    Android:真机调试遇到的问题(You need to use a Theme.AppCompat theme (or descendant) with this activity). 在调试&l ...

  4. 【我的Android进阶之旅】解决bug:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    前言 今天用Android Studio 生成Activity的时候,默认继承AppCompatActivity ,而在AndroidManifest.xml我对该Activity设置了一个主题,然后 ...

  5. 我的Android进阶之旅------>解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    #1.错误描述 今天,想实现Activity不显示标题栏的效果,在项目的AndroidManifest.xml文件,对相应的Activity添加属性 android:theme="@andr ...

  6. android对话框显示异常报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    今天写android实验碰到到一个问题,在用AlertDialog.Builder类构建一个对话框之后,调用Builder.show()方法时抛出异常如下: - ::-/xyz.qlrr.sqlite ...

  7. 报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    学习 Activity 生命周期时希望通过 Dialog 主题测试 onPause() 和 onStop() 的区别,点击按钮跳转 Activity 时报错: E/AndroidRuntime: FA ...

  8. You need to use a Theme.AppCompat theme

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dji.sdk.sample/com.dji.sdk.sa ...

  9. java.lang.IllegalStateException: You need to use a theme.appcompat theme (or descendant) with this activity

    错误描述:java.lang.IllegalStateException: You need to use a theme.appcompat theme (or descendant) with t ...

随机推荐

  1. UVa 2197 & 拆点分环费用流

    题意: 给你一个带权有向图,选择一些边组成许多没有公共边的环,使每个点都在k个环上,要求代价最小. SOL: 现在已经养成了这种习惯,偏题怪题都往网络流上想... 怎么做这题呢... 对我们看到每个点 ...

  2. Codeforces Round #364 (Div. 2) B. Cells Not Under Attack

    B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  3. Android Fragment 生命周期及其API使用(建议使用自定义View替换Fragment)

    我为什么不主张使用Fragment Fragment:( Fragment就相当于一个有生命周期的View,它的生命周期被所在的Activity的生命周期管理 ) 生命周期回调说明: onAttach ...

  4. 2076. The Drunk Jailer

    Problem A certain prison contains a long hall of n cells, each right next to each other. Each cell h ...

  5. ffplay 播放yuv

    ffplay -f rawvideo -video_size 1920x1080 a.yuv ffplay -i raw_out2.yuv -pix_fmt yuv422p -s 1280x720

  6. ios8 tableView设置滑动删除时 显示多个按钮

      ** *  tableView:editActionsForRowAtIndexPath:     //设置滑动删除时显示多个按钮 *  UITableViewRowAction          ...

  7. OpenFileDialog获取文件名和文件路径问题

    OpenFileDialog获取文件名和文件路径问题(转) 转自:http://blog.sina.com.cn/s/blog_7511914e0101cbjn.html System.IO.Path ...

  8. Hibernate中易错地方的总结

    1.Hibernate中的配置文件要放在src下,注意不能放在包目录下 2.Hibernate中@Before   @After方法不能再普通的类里用,只有在专门的JUnit测试用例里面用. 3.使用 ...

  9. mysql主从复制过滤

    主从复制过滤: 配置文件中的[mysqld]块中: master:(考虑到即时点还原一般不在主过滤) binlog_do_db= #数据库白名单 binlog_ignore_db= #数据库白名单 s ...

  10. thinkphp无法加载模块解决办法

    前台入口文件index.php <?php //前台入口 define('THINKPHP_PATH', '../ThinkPHP/');//底层的位置 define('APP_PATH', ' ...