【发布时间】:2017-08-12 04:57:03
【问题描述】:
我是 android 编程新手,但描述我的问题的所有问题似乎都没有帮助。
Edittext color is white in appcompat 22.2
Android EditText Text Color is always white
Android edittext color white on white background
我正在看的东西肯定是超级愚蠢的
我的活动:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@string/font_family_regular"
android:hint="@string/user_name"
android:maxLines="1"
android:nextFocusDown="@+id/password"
android:imeOptions="actionNext"
android:inputType="text"
android:text=""
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
我的样式 XML
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="android:textColor">@android:color/black</item>
<item name="android:textColorHint">@android:color/darker_gray</item>
<item name="colorAccent">#0000FF</item>
<item name="colorControlNormal">#0000FF</item>
<item name="colorControlActivated">#0000FF</item>
</style>
</resources>
Gradle 应用程序
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 19
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 {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
【问题讨论】:
-
更改 style.xml 中的主题并检查
-
我将其更改为 Theme.AppCompat 并且结果相同 您还有其他建议吗?
-
你也可以发布你的应用 gradle 吗??
-
@merjr 请检查我的答案
-
@OmarDanisha 添加了
标签: android android-edittext android-appcompat