标签:manage player code cti des div apple dsc 描述
具体代码如下:
<activity android:name=".myview.videoplayactivity.videoplayer.FullScreenPlayActivity"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
>
</activity>
结果运行app的时候,报了如下错误:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
具体错误log如下:
Process: com.example.dell.newscenter, PID: 31394
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.example.dell.newscenter/com.example.dell.newscenter.myview.videoplayactivity.videoplayer.FullScreenPlayActivity}:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
原来我的Activity继承自 Android.support.v7.app.AppCompatActivity,而不是 android.app.Activity。
1、创建的activity时,如果不是那么强烈需要继承自AppCompatActivity,就直接继承Activity。
如将activity继承自AppCompatActivity:
public class MainActivity extends ActionBarActivity
改成activity继承自Activity:
public class MainActivity extends Activity
<style name="NoTitleFullscreen" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> </style>
<activity android:name=".myview.videoplayactivity.videoplayer.FullScreenPlayActivity" android:screenOrientation="landscape" android:theme="@style/NoTitleFullscreen" ></activity>
requestWindowFeature(Window.FEATURE_NO_TITLE); //设置无标题
getWindow().setFlags(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT); //设置全屏
setContentView(R.layout.image_list_layout);// 上面两句 必须在此句之前
标签:manage player code cti des div apple dsc 描述
原文地址:https://www.cnblogs.com/the-wang/p/9113875.html