Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当我试图删除标题栏时,应用程序崩溃_Java_Android - Fatal编程技术网

Java 当我试图删除标题栏时,应用程序崩溃

Java 当我试图删除标题栏时,应用程序崩溃,java,android,Java,Android,我有以下错误: 缺少类一个或多个布局缺少布局宽度或 布局和高度属性 及 此处不允许元素活动 这是我的布局 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res

我有以下错误:

缺少类一个或多个布局缺少布局宽度或 布局和高度属性

此处不允许元素活动

这是我的布局

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.niklas.uebungsrechner.MainActivity"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">

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

你应该搬出去:

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

从您的代码中,并以以下内容结束xml:

</android.support.constraint.ConstraintLayout>

你应该搬出去:

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

从您的代码中,并以以下内容结束xml:

</android.support.constraint.ConstraintLayout>

您还可以在onCreate方法的Activity java文件中添加这段代码。通过这种方式,您可以轻松选择哪些活动有标题,哪些没有标题

ActionBar ab=getSupportActionBar();

ab.隐藏()

您还可以在onCreate方法中的Activity java文件中添加这段代码。通过这种方式,您可以轻松选择哪些活动有标题,哪些没有标题

ActionBar ab=getSupportActionBar();

ab.隐藏()

这应该在
manifest.xml
文件中,而不是在布局文件中

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

这应该在您的
manifest.xml
文件中,而不是布局文件中

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

这应该是您的布局文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.niklas.uebungsrechner.MainActivity"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">

</android.support.constraint.ConstraintLayout>

这将隐藏标题栏。

这应该是您的布局文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.niklas.uebungsrechner.MainActivity"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">

</android.support.constraint.ConstraintLayout>

这将隐藏标题栏。

版面中不能有活动。活动标记应仅用于清单中,布局中不能有活动。活动标签应该只在清单中使用,第一位应该在你的Android清单中,但当我在清单中有这个Android:theme=“@Android:style/theme.NoTitleBar”时,它仍然会崩溃(我像Vlado Pandzic说的那样做)我在android studio中看不到任何错误我只看到我的智能手机上的应用程序已关闭,第一位应该在你的android清单中,但当我在清单中有这个android:theme=“@android:style/theme.NoTitleBar”时,它仍然会崩溃(我像Vlado Pandzic说的那样做)我在android studio中看不到任何错误,我只看到我的智能手机上的应用程序已关闭