这是我的build.gradle
文件:
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:cardview-v7:21.0.+'
...
}
在我添加之前:
compile 'com.android.support:design:22.2.0'
现在,当我构建或重建我的项目(我已经同步gradle
了几次)时,我得到了这个错误:
.../utils/CustomEditText.java
Error:(6, 42) Gradle: error: cannot find symbol class TintEditText
Error:(14, 35) Gradle: error: cannot find symbol class TintEditText
Error:(37, 8) Gradle: error: cannot find symbol method isInEditMode()
Error:(57, 3) Gradle: error: cannot find symbol method setTypeface(Typeface)
Error:(65, 5) Gradle: error: method does not override or implement a method from a supertype
Error:(67, 23) Gradle: error: cannot find symbol variable super
...
在 my CustomEditText
(that extends TintEditText
) 和所有使用 that 的活动内部CustomEditText
。
导入不会引发任何错误,也不会Class:
import android.support.v7.internal.widget.TintEditText;
会是什么呢?
更新:
使用ianhanniballake建议,AppCompatEditText
而不是 internal TintEditText
,解决了编译时错误并回答了这个问题,但现在我遇到了运行时错误:
java.lang.IllegalArgumentException: AppCompat does not support the current theme features
我已经看到了一些与此相关的问题,并且提到的解决方案类似于:
<style name="MyMaterialTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
...
</style>
但我不想放弃这种方法,因为我有一些Activities
使用ActionBar
,而另一些则没有。我的风格是:
<style name="MyTheme" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/txt_light_grey</item>
<item name="colorControlActivated">@color/default_orange</item>
<item name="colorControlHighlight">@color/txt_light_grey</item>
</style>
<style name="MyTheme.ActionBar.Orange" parent="MyTheme">
<item name="windowActionBarOverlay">false</item>
<item name="colorPrimary">@color/default_orange</item>
</style>
<style name="MyTheme.FullScreen" parent="MyTheme">
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
在我的基地内,Activity
我这样做:
getWindow().requestFeature(mActionBarView != null ? Window.FEATURE_ACTION_BAR : Window.FEATURE_NO_TITLE);
启用或禁用ActionBar
.
正如我所说,在我添加'com.android.support:design:22.2.0'
或更新appcompat-v7:22.0.0
到 22. 2 .0 之前,这非常有效。我只想使用 a TabLayout
,但我想我不会...