
我是Android开发的新手,我的AndroID Studio 3.1.3演示项目或我创建的任何项目都有这个问题.
即使我可以在我的设计视图(ConstraintLayout)上拖放不同的控件但在设计视图中没有显示任何控件,它会显示一段时间然后消失.
我可以在activity_main.xml文本选项卡,组件树甚至运行模式中看到我拖放的所有元素,但是在设计选项卡中没有显示,设计视图中没有显示任何元素,它总是空白,甚至没有hello world show.
我尝试了无效缓存重启,重启我的电脑,更改放大 – 进出,推断约束,但没有运气.控制
除非我在设计视图中看到东西,否则我做不了多少.
空设计视图:
运行模式视图
activity_main.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"> <button androID:ID="@+ID/button2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="button" /> <button androID:ID="@+ID/button4" androID:layout_wIDth="wrap_content" androID:layout_height="0dp" androID:text="button" /> <androID.support.constraint.GuIDeline androID:ID="@+ID/guIDeline" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:orIEntation="vertical" app:layout_constraintGuIDe_begin="20dp" /> <CheckBox androID:ID="@+ID/checkBox" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="CheckBox" tools:layout_editor_absoluteX="154dp" tools:layout_editor_absoluteY="181dp" /></androID.support.constraint.ConstraintLayout>AndroIDManifest.xml中
<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID" package="com.example.libra.myapplication"> <application androID:allowBackup="true" androID:icon="@mipmap/ic_launcher" androID:label="@string/app_name" androID:roundIcon="@mipmap/ic_launcher_round" androID:supportsRtl="true" androID:theme="@style/Apptheme"> <activity androID:name=".MainActivity"> <intent-filter> <action androID:name="androID.intent.action.MAIN" /> <category androID:name="androID.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>的build.gradle
apply plugin: 'com.androID.application'androID { compileSdkVersion 28 defaultConfig { applicationID "com.example.libra.myapplication" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionname "1.0" testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" } buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' } }}dependencIEs { implementation filetree(dir: 'libs', include: ['*.jar']) implementation 'com.androID.support:appcompat-v7:28.0.0-Alpha3' implementation 'com.androID.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androIDTestImplementation 'com.androID.support.test:runner:1.0.2' androIDTestImplementation 'com.androID.support.test.espresso:espresso-core:3.0.2'}解决方法:
好的,我的问题解决了!
The following classes could not be instantiated: – android.support.v7.widget.Toolbar
我从这里更改了res / values / styles.xml文件:
<style name="Apptheme" parent="theme.AppCompat.light.DarkActionbar">对此:
<style name="Apptheme" parent="Base.theme.AppCompat.light.DarkActionbar">这解决了这个问题
总结以上是内存溢出为你收集整理的Android Studio 3.1.3,设计视图始终为空全部内容,希望文章能够帮你解决Android Studio 3.1.3,设计视图始终为空所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)