简体   繁体   English

我在activity_main.xml中看不到textview和其他元素布局android studio

[英]I cant see textview and other elements layout android studio in activity_main.xml

This error is displayed: 显示此错误:

Render problem - Failed to load AppCompat ActionBar with unknown error. 渲染问题-无法加载未知错误的AppCompat ActionBar。


xml (text): xml(文本):

<?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=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    </android.support.constraint.ConstraintLayout>

Main activity(java): 主要活动(java):

package net.ggg.ddd.myapp1;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

image of log: 日志图片:

enter image description here 在此处输入图片说明

In your styles.xml change 在你的styles.xml中更改

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

The main problem is the AppCompat version.I changed the AppCompat version to latest(27.1.1 instead of 28+ or alfa versions and so on).In this case, I have to change the minsdkversion and the targetsdkversion to 27.Then gradle sync again. 主要问题是AppCompat版本。我将AppCompat版本更改为最新版本(27.1.1,而不是28+或alfa版本等)。在这种情况下,我必须将minsdkversion和targetsdkversion更改为27.然后gradle sync再次。 I have shown this in the picture: 我在图片中显示了这个:

picture 图片

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio Activity_main.xml - Android Studio Activity_main.xml 创建新的Android Studio项目时,为什么看不到activity_main.xml中的文本? - Why can't I see text in activity_main.xml when I create a new Android Studio project? 我的 android 工作室在打开 activity_main.xml 时显示图形 - My android studio shows graphic on opening activity_main.xml activity_main.xml未在Android中加载 - activity_main.xml is not loading in android Android Studio 1.4-解释activity_main.xml和content_main.xml - Android Studio 1.4 - Explain activity_main.xml and content_main.xml Android Studio:activity_main.xml和content_main.xml未显示设计预览&amp;&amp; ClassNotFoundException - Android Studio: activity_main.xml and content_main.xml not showing design preview && ClassNotFoundException Eclipse从布局文件夹中创建新的Android应用程序项目activity_main.xml文件 - Eclipse create new android application project activity_main.xml file missing from layout folder Android Studio activity_main.xml设计编辑器不让我拖放任何东西......? - Android Studio activity_main.xml design editor not letting me drag and drop anything…? Android Mainactivity不显示activity_main.xml - Android Mainactivity doesn't show activity_main.xml 如何解析android activity_main.xml文件并进行修改? - How can I parse android activity_main.xml file and modify it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM