gpt4 book ai didi

java - 在Android上使用圆形 ImageView

转载 作者:行者123 更新时间:2023-12-01 09:02:39 26 4
gpt4 key购买 nike

我在 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'
}

它不会使我的图片带有边框

最佳答案

我检查了这行代码工作得很好,我从您的代码中得到以下输出: enter image description here

Option 1: Clean the project or rebuild the project

选项 2:重新同步 gradle。 enter image description here

Option 3: Update your Android Studio.

如果三个选项中的任何一个不起作用,则说明您的样式文件中存在错误,请检查并更正它们。

关于java - 在Android上使用圆形 ImageView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41550367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com