应用可以在模拟器上完美显示,但不能在设计预览上完美显示吗? [英] App displays perfectly on emulator but not on design preview?

查看:50
本文介绍了应用可以在模拟器上完美显示,但不能在设计预览上完美显示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案三

"3:从设置更新sdk或下载最著名的Android sdk api"

进入您的android设置并打开sdk管理器!下载其他适用于android的android api完全将其安装!

解决方案四

"4将您的android studio更新为最新的构建工具和最新的api"

进入帮助"菜单,然后按检查更新,并遵守规则!

Edit: new image displaying rendering errors(first time asking a question, sorry if I've left anything out!) I haven't come across a solution for this. On google there's only solutions to the reverse of this where the emulator isn't showing what the design preview is! It must be something to with my themes because I have rendering problems: "Failed to find style 'textInputStyle' in current theme". However I've tried to switch between every theme with no improvement.

Honestly just confused as to why it would work perfectly on the emulator but not on the preview, It would be handier to have this function working rather than building and running for every single change, thanks!

This is my styles.xml: `

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColor">@color/colorText</item>
    <item name="android:textColorHint">@color/colorText</item>
    <item name="colorControlNormal">@color/colorText</item>
    <item name="colorControlActivated">@color/colorText</item>
</style>

`

and the manifest:

<?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name="com.example.cathy.myapplication.activities.LoginActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.cathy.myapplication.activities.RegisterActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.example.cathy.myapplication.activities.UsersListActivity"
        android:screenOrientation="portrait" />
</application>

解决方案

There can be many reasons causing this issue! lets see them one by one!

In android studio cache is one issue so first follow the solution 1!

SOLUTION ONE

"1: INVALIDATING CACHE AND RESTART"

As in your provided styles you are not changing any builtin theme style then this input is one clear sign that android studio is not properly responding with the design part of the project that you require to build!

So GO to FILE menu ==> Invalidate Cache and Restart and see if that works! on restart ! this should!

SOLUTION TWO

"1: Selecting the proper design render sdk option"

In the image I encircled the option to select by default it select what's more suitable but Softwares do make tiny mistakes too! so try changing the sdk version there! if you have multiple sdk platforms installed for android! This will refresh the design in the design area!

SOLUTION Three

"3: Updating the sdk from settings or Downloading most famously used Android sdk api"

go in your settings of android and open sdk manager! download any other android api for android install it completely!

SOLUTION Four

"4 Update your android studio to latest build tools and latest apis"

Go in Help Menu and press Check for updates and follow the rules!

这篇关于应用可以在模拟器上完美显示,但不能在设计预览上完美显示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆