Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ImageView未显示(Android)_Android_Android Layout - Fatal编程技术网

ImageView未显示(Android)

ImageView未显示(Android),android,android-layout,Android,Android Layout,我有以下代码: <?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" xmlns:tools="http://schemas.android.com/tools" android:

我有以下代码:

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"

    tools:context="com.example.ioann_000.cainstructionquiz.PlayActivity"
    android:clickable="false"
    android:animationCache="false"
    android:clipChildren="false"
    android:contextClickable="false"
    android:filterTouchesWhenObscured="false"
    android:layout_alignParentBottom="false"
    android:layout_alignParentRight="false"
    android:saveEnabled="false">


    <TextView
        android:text="@string/CainstructionQuiz"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="12dp"
        android:id="@+id/CainTxtView"
        android:textSize="30sp"
        android:textColor="@color/colorPrimary"
        android:textStyle="normal|italic" />

    <Button
        android:id="@+id/exit_btn"

        android:textColor="#121111"
        android:textSize="30sp"

        android:layout_width="120dp"
        android:background="@drawable/buttonshape"
        android:shadowColor="#A8A8A8"
        android:shadowDx="7"
        android:shadowDy="-2"
        android:shadowRadius="25"
        android:layout_height="39dp"
        android:layout_marginBottom="25dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:text="ΕΞΟΔΟΣ"
        android:elevation="0dp" />

    <Button
        android:id="@+id/Start_btn"

        android:text="@string/PlayTxt"
        android:textColor="#121111"
        android:textSize="30sp"

        android:layout_width="120dp"
        android:background="@drawable/buttonshape"
        android:shadowColor="#A8A8A8"
        android:shadowDx="7"
        android:shadowDy="-2"
        android:shadowRadius="25"
        android:layout_height="39dp"
        android:layout_marginBottom="24dp"
        android:layout_above="@+id/exit_btn"
        android:layout_alignStart="@+id/exit_btn" />

    <ImageView

        android:layout_width="200dp"
        app:srcCompat="@drawable/maths_0"
        android:id="@+id/imageView2"
        android:layout_height="150dp"
        android:layout_marginBottom="74dp"
        android:layout_above="@+id/Start_btn"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

但是,
imageview
没有显示。。。我试图重新制作
图像视图
,但在设计模式显示时,没有任何效果,但在运行应用程序时,没有。 需要帮忙吗?谢谢大家!

添加
android:src=“@drawable/yourmage
”或
android:background=“@color/red
”然后您将看到您的
ImageView

编辑


app:srcCompat
替换为
android:src

同时添加您的java代码…///add
android:src=“@drawable/yourImage”
android:background=“@color/red”
,然后您将看到您的imageView。@JohnJoe Joe正在工作,请将其作为答案编写;)!你只需将这些元素添加到你的
ImageView
元素中?我用
android:src=“@drawable/mathematics\u 0”替换了
app:srcCompat=“@drawable/mathematics\u 0”
,很高兴它有所帮助。