Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/346.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
Java 如何在视图上重复图像_Java_Android_Xml_Kotlin - Fatal编程技术网

Java 如何在视图上重复图像

Java 如何在视图上重复图像,java,android,xml,kotlin,Java,Android,Xml,Kotlin,我试图在ImageView上重复一个图像。 我尝试在imageView上使用位图作为src,但问题是,在不同的屏幕大小上,重复正在更改,我需要修复它,并在所有屏幕大小上看起来相同,请提供帮助 到目前为止我做了什么 图像视图 <ImageView android:src="@drawable/test" android:scaleType="fitXY" android:layout_width="match_parent" a

我试图在
ImageView
上重复一个图像。 我尝试在imageView上使用位图作为
src
,但问题是,在不同的屏幕大小上,重复正在更改,我需要修复它,并在所有屏幕大小上看起来相同,请提供帮助

到目前为止我做了什么

图像视图

<ImageView
        android:src="@drawable/test"
        android:scaleType="fitXY"
        android:layout_width="match_parent"
        android:layout_height="25dp"
        android:background="@color/white"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/item_event_category_calender3"
        app:layout_constraintVertical_bias="0.0" />

还有位图

<bitmap
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/circle_grey_new"
        android:tileMode="repeat"
        android:dither="true"/>

此图像位于可绘制文件夹中。在下面的ImageView中放置png文件的语法

    <ImageView
    android:id="@+id/ivLogo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:layout_marginStart="32dp"
    android:layout_marginTop="180dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/devslopesprofilelogo" />

您需要相同图像的hdpi、mdpi、xhdpi、xxhdpi、xxxhdpi 如果您正在设计Pixil-C平板电脑,则将使用xxhdpi 如果您正在设计Nexus 5手机,将使用hdpi 所有这些大小都位于文件夹devslopesprofilelogo中,扩展名附加到相应的png文件图像

最好使用约束布局,如果图像是位图,则此类型的图像应为true