我在 xml 布局上使用圆形 ImageView ,但出现此错误:
Exception Details java.lang.NoClassDefFoundError: de/hdodenhof/circleimageview/R$styleable at
de.hdodenhof.circleimageview.CircleImageView.<init>(CircleImageView.java:91) at
de.hdodenhof.circleimageview.CircleImageView.<init>(CircleImageView.java:85)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
我阅读了它的官方网站,并且确实喜欢这个网站,但对我来说没有任何作用。 这是我的 xml 配置布局,我像这个网站一样使用:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_centerInParent="true"
android:src="@mipmap/ic_launcher"
app:civ_border_width="2dp"
app:civ_border_color="@color/colorAccent" />
</RelativeLayout>
我的网格:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
// compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
它不会使我的图片带有边框
最佳答案
Option 1: Clean the project or rebuild the project
Option 3: Update your Android Studio.
如果三个选项中的任何一个不起作用,则说明您的样式文件中存在错误,请检查并更正它们。
关于java - 在Android上使用圆形 ImageView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41550367/