简体   繁体   English

在网格布局的图像布局中看不到Android Studio NO图像

[英]Android Studio NO image is Seen in Image-Layout over Grid Layout

The code is shared AS 该代码是共享的AS

<GridLayout
        android:id="@+id/gridLayout"
        android:layout_width="368dp"
        android:layout_height="368dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/board"
        android:columnCount="3"
        android:rowCount="3"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"

            android:tag="0" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="17dp"

            android:tag="1" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="12dp"

            android:tag="2" />

        <ImageView
            android:id="@+id/imageView4"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginTop="13dp"

            android:tag="3" />

        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="17dp"
            android:layout_marginTop="13dp"

            android:tag="4" />

        <ImageView
            android:id="@+id/imageView6"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="12dp"
            android:layout_marginTop="13dp"

            android:tag="5" />

        <ImageView
            android:id="@+id/imageView7"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginTop="16dp"

            android:tag="6" />

        <ImageView
            android:id="@+id/imageView8"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="17dp"
            android:layout_marginTop="16dp"

            android:tag="7" />

        <ImageView
            android:id="@+id/imageView9"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_margin="10dp"
            android:layout_marginLeft="12dp"
            android:layout_marginTop="16dp"

            android:tag="8" />


    </GridLayout>

NO Images are seen This Problem is not going off please help BUt this thing is working on Andriod Emulator The same Thing is working in EMultaor 没有图像被看到这个问题没有解决,请帮助BUt这个东西正在Andriod Emulator 上运行EMultaor中正在运行相同的东西

I have also re-installed the android studio but in vain no effect is seen I also have tried by creating a new project and by restarting the application 我还重新安装了android studio,但徒劳无功,我也尝试过创建新项目并重新启动应用程序

You need to specify android:src="@..." in your ImageViews if you want to display them in the design preview. 如果要在设计预览中显示它们,则需要在ImageViews中指定android:src="@..."
If you only set the Image in your Activity class, like 如果您仅在活动类中设置图片,例如

((ImageView)findViewById(R.id.imageView1)).setImageDrawable(...);

they will not be displayed until the program is executed. 在程序执行之前,它们不会显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM