0

I have a HorizontalScrollview and I want to have a repeatable image, so I can scroll infinite to left or right. This is my XML code

  <HorizontalScrollView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:scrollbars="none"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageview_scroll"
                android:layout_width="wrap_content"
                android:layout_height="match_parent" />

        </LinearLayout>

    </HorizontalScrollView>

and this is my Java code

    ImageView imageView = findViewById(R.id.imageview_scroll);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.scroll);
    BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
    bitmapDrawable.setTileModeX(Shader.TileMode.REPEAT);

    imageView.setImageBitmap(bitmap);

However, this code displays the image only once and does not repeat.

How can I achieve this?

tomhogenkamp
  • 83
  • 1
  • 11

0 Answers0