重复绘制的ImageView的?ImageView

2023-09-05 11:21:41 作者:不想一个人却只能一个人

是否有可能在ImageView的重复绘制?我设法重复我绘制在一个ListView分频器,但不是作为一个ImageView的。这是我重复的图像清晰度:

Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition:

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

谢谢 马库斯

Thanks Markus

推荐答案

您可以使用一个虚拟的观点像的LinearLayout来实现这一目标。只需创建你需要的大小的LinearLayout,并设置其背景绘制是你重复的位图。

You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your repeating bitmap.

请参阅 Android的瓷​​砖位图。