【发布时间】:2015-08-08 19:46:20
【问题描述】:
我正在使用 CircularImageView 库在我的应用中显示圆形图像。
在我的 xml 文件中,
<GridLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.pkmmte.view.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/image"
app:border_color="#EEEEEE"
app:border_width="4dp"
/>
<ImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/image2"/>
</GridLayout>
Android Studio 没有显示@drawable/image。 'image.jpg' 存在于我的可绘制文件夹中。当我在drawable/ 之后点击CTRL+SPACE 时,我没有得到任何建议。
奇怪的是下一个 ImageView 中的代码android:src="@drawable/image2" 完美运行,提供建议等。
我也尝试将这些图像添加到 CircularImageView 的可绘制文件夹中。
我已经尝试清理和重建项目,但不起作用。
app -> build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.appquest.fitterfox"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile project(':libraries:loadtoast')
compile project(':libraries:circleimageview')
}
【问题讨论】:
-
不要手动添加项目,而是使用 compile 'com.pkmmte.view:circularimageview:1.1' 获取成绩并从 maven 添加项目
-
只是在依赖项中添加一行,对吗?好吧,现在就这样做..
-
顺便问一下,为什么它以前不起作用?
-
图片正在显示,但仍未给出建议...
-
我也遇到了自定义视图的错误。这似乎是 Android Studio 中的一个错误
标签: android xml android-studio