在Nougut上的setError问题!在较低版本上看起来很好

时间:2018-04-13 07:56:19

标签: android

问题是setError()消息在较高版本Nougat中未正确显示,并且在较低版本中看起来很好,直到Marshmallow

if (text.length() == 0) {

       editText.setError("Enter Password");//get value from resource

}

它着眼于初始阶段

enter image description here

单击EditText时,edittext就像

enter image description here

app.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.android.errormsg"
        minSdkVersion 15
        targetSdkVersion 26
        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:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.hbb20:ccp:2.1.4'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'uk.co.chrisjenx:calligraphy:2.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
}

project.gradle

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
}

XML

<EditText
                android:id="@+id/id_edtemail"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:background="@drawable/edittext_style">

0 个答案:

没有答案
相关问题