1

我最近升级了Android Studio 2.2 preview 3 但是EditText样式变了,在preView中: 在此处输入图像描述

但是在我的手机上运行,​​它是这样的: 在此处输入图像描述

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.hyh.newlearn.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />

    <EditText
        android:id="@+id/et_show"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:hint="Hello World"/>

</RelativeLayout>

样式.xml:

<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>

为什么?如何处理?

4

2 回答 2

1
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
//        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

如果我使用类路径'com.android.tools.build:gradle:2.2.0-alpha3',它将显示错误视图。

如果我使用类路径'classpath'com.android.tools.build:gradle:1.5.0'',它将显示正确的视图。

于 2016-06-16T08:20:10.083 回答
0

我有同样的问题。

雨浩,这是我的问题

16-19 的 sdk 版本上的 android edittext 显示不正确。

但我认为这是 api 的原因。

你是对的。我们必须使用最新的稳定版本 'com.android.tools.build:gradle:2.1.0'

于 2016-07-05T16:49:57.310 回答