0

I have tried alot to solve and did as this link StackOverflow but nothing happens..I introduce myself as a beginner in android programming and learning myself .This is the problem I cannot solve.

//Code of styles.xml from values folder

<?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
            <item name="android:layout_width">fill_parent</item>
            <item name="android:layout_height">wrap_content</item>
            <!--<item name="android:textColor">#00FF00</item>-->
            <!--<item name="android:typeface">monospace</item>-->
        </style>
    </resources>

//AND Code for build.gradle Module:app is

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.madhav.schoolmanagement"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    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'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:+'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.android.support:appcompat-v7:28.0.0'
}

repositories {
    google()
}

buildscript {
    repositories {
        google()
    }
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
SM123
  • 25
  • 1
  • 11
  • 1
    In your screen shot, there is an red circle with exclamatory mark (next to zoom buttons). Click on that you will get some idea why preview is not showing. – sohel yadav Feb 20 '19 at 08:04
  • 1
    try to paste the same resource which is in my answer and rebuild your project – Vipul Chauhan Feb 20 '19 at 08:05
  • @VipulChauhan I have done as you said but nothings works – SM123 Feb 20 '19 at 08:14
  • Finally it is solved by this link [https://stackoverflow.com/questions/42477738/rendering-problems-note-one-or-more-layouts-are-missing-the-layout-width-or-lay]. Thank you very much for your help.@VipulChauhan,@sohel yadav ,@Nurlan – SM123 Feb 20 '19 at 08:38

3 Answers3

1

Yes, it occurs to some users try thi if it help you

1 Go to app

2 src

3 main

4 res

5 values // open this..

then update this as

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

Vipul Chauhan
  • 189
  • 4
  • 19
  • because i am also stuck in this problem when i was started work with studio – Vipul Chauhan Feb 20 '19 at 08:03
  • 1
    okay sorry i think it is another error as you told above you already tried clean project and invalidate and restart. I don't know the another solution for that but I have one solution for you that try the same layout in another project is this actually layout problem or android studio promblem – Vipul Chauhan Feb 20 '19 at 08:19
0

Default styles.xml should look like this

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
0

I think you have not Updated your Android Studio. And Solution for this is Base.Theme.AppCompat.Light.NoActionBar