user7524392
user7524392

Reputation: 25

any View not appearing in the android studio editor

when building the app the view i've put in appears but in the editor it is not appearing, and sometimes when i create a ImageView some of the images I pasted in the drawables causes rendering problems. I recently updated my android studio and now it is full of bugs.the image attached below is a new project, I only added image view and convert it to relative layout since constraint layout gives me a ton of errors. thank you for answering my question.enter image description here

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:visibility="visible"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="Hello World!"
        android:textAppearance="@style/TextAppearance.AppCompat"
        android:visibility="visible" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="30dp"
        android:layout_height="30dp" />

</RelativeLayout>

P.S.

the image view's src or compatsrc stuff, I've deleted it since it causes errors when building just to test it out. and when opening existing projects the app folder seems to be deleted/moved.

here is the gradle file

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.rowel.animation"
        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-rc01'
    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'

Upvotes: 0

Views: 140

Answers (2)

The Badak
The Badak

Reputation: 2030

SDK 28 is buggy and has lots of layout issues and program bugs.


you can try adding Base. to your theme's parent in styles.xml

eg:

<resource>
   <style name="AppTheme" parent="Theme.AppCompat">
   ...

to

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

if doesn't work, then try Invalidating Cache

if that doesn't work either, try changing targetSdkVersion to 27 or below

Upvotes: 1

Shubham Vala
Shubham Vala

Reputation: 1043

Change your compileSdkVersion and targetSdkVersion to 27

and also change this

implementation 'com.android.support:appcompat-v7:27.1.1'

Upvotes: 1

Related Questions