android布局中的图像视图
我正在尝试在android中创建imageview,但在执行过程中,我发现资源id中的此e错误不能是“id”处的空字符串,其值为“@+id/” 你必须声明一个IDandroid布局中的图像视图,android,Android,我正在尝试在android中创建imageview,但在执行过程中,我发现资源id中的此e错误不能是“id”处的空字符串,其值为“@+id/” 你必须声明一个ID <RelativeLayout xmlns:android="schemas.android.com/apk/res/android"; xmlns:tools="schemas.android.com/tools"; android:layout_width="match_par
<RelativeLayout
xmlns:android="schemas.android.com/apk/res/android";
xmlns:tools="schemas.android.com/tools";
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:id="@+id/ExampleID"> // Give your Id here..
这样做:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageButton
android:id="@+id/btnSpeak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:contentDescription="@string/speak"
android:src="@android:drawable/ic_btn_speak_now" />
</LinearLayout>
如果您的id值为空,请检查您的xml文件,或者检查您的ImageView id。至少粘贴一些代码,这是您迄今为止所尝试的。在java和xml中,我在这行中遇到了问题示例ID是什么?只需在ID中加上一个名称,或者将整个xml文件粘贴到问题中请好,谢谢Skizo的工作现在我有错误:错误:40,22未找到与“src”处的给定名称与值“@drawable/kink”匹配的资源。代码:执行后,当我单击更改图像按钮时,图像按钮未更改。当我单击更改图像按钮时,应用程序执行后,图像未更改