I want to repeat the image with ImageView
with in RelativeLayout
. Can it be possible to use the Bitmap xml and use tilemode "repeat"
with RelativeLayout
, because what I have seen things on Internet they all dealing with LinearLayout
.
Any help or tip will be warmly welcomed.
Yes, its possible. Define your repeating image as Drawable (bitmap) with android:tileMode="repeat" in XML and use it as background of your RelativeLayout . Save this answer. Show activity on this post.
You can make a view clickable, as a button, by adding the android:onClick attribute in the XML layout. For example, you can make an image act like a button by adding android:onClick to the ImageView .
ImageButton has the same property as ImageView . Only one feature is extra, which is, images set through ImageButton are clickable, and actions can be attached with them upon clicking. Just like a button, the setOnClickListener() can be used to set an event listener for click event on this.
Create an XML file named background in Drawable folder
background.xml
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/imagename" android:tileMode="repeat" />
In your Relative Layout add the above XML as background
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:background="@drawable/background" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With