Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid tiling a background image: using a Bitmap resizes the image?
    primarykey
    data
    text
    <p>I'd like to have a tiled background in a layout I've created, in the x-direction. I've followed some good instructions found online to tile correctly, but the source image is now stretched vertically a good bit. I think it has to do with the nature of bitmap filetypes.</p> <p>Example picture:</p> <p><img src="https://i.stack.imgur.com/sk2Ct.png" alt="enter image description here"></p> <p>The first image is the background image before tiling. The second image is after tiling. As you can see, the image is stretched vertically a good bit, and also appears a bit blurry due to the resizing.</p> <p>I've tried placing the images in both the drawable-hdpi and drawable folder. I've tried placing the XML file in both folders. None of that seemed to matter.</p> <p>Here is the code for the layout that generated those two images:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:background="@drawable/bg" /&gt; &lt;ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dip" android:background="@drawable/bg_repeat" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>"@drawable/bg" is the actual image itself, bg.png. "@drawable/bg_repeat" is the following bitmap XML file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/cdetail_bg_unclaimed_details" android:antialias="false" android:dither="false" android:filter="false" android:gravity="center|center_vertical" android:tileMode="repeat" /&gt; </code></pre> <p>Is there an alternative to this for x-repeat tiling? Or is there some workaround that I haven't examined yet? I've changed all of the options for antialias, dither, filter, etc. Nothing seemed to change anything.</p> <p>Thanks for the help!</p> <p>EDIT: This appears to be a bug using the Graphical Layout tool. It looks OK on my phone.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload