Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set borders for a drawable that repeats horizontally?
    text
    copied!<p>I'm using a layer-drawable and inside it I have one BitmapDrawable that repeats only horizontally. But I need to add borders for this drawable. But I didn't find any solution for this!</p> <p>I tried to create a ShapeDrawable and set my BitmapDrawable as background of my ShapeDrawable, but it's not possible. I tried to find a method that add borders for my ShapeDrawable, but I didn't find it.</p> <p>I also added 2 other images, that would be the box_top_left and box_top_right. With this idea, I only need now to make it appear in this order: box_top_left, box_repeat, box_top_right. But i'm also having trouble to do this!</p> <p>I've found a several ways to change a drawable's padding in my xml but not during the execution. I can't just set it on my xml because I don't know the total width. And I didn't find any way to make my drawable the exactly width of my image.</p> <p>Can somebody help me, plz?</p> <p>I'll post some images to help you to understand what I want to do. The first image is how it should be:</p> <p><img src="https://i.imgur.com/BbXVU.jpg" alt="image 1"></p> <p>Inside my Dialog, at the top, above the text "Acesso ao sistema" I have my image that sould repeat. I used a layer-drawable for my Dialog's background with a item that is the shape for my dialog and another item that should have my BitmapDrawable repeating only horizontally.</p> <p>This second image is only missing to add my box_top_left and box_top_right. <img src="https://i.imgur.com/R66Mx.png" alt="image 2"></p> <p>This third image is what happens when I don't use borders: <img src="https://i.imgur.com/00G70.png" alt="image 3"></p> <p>And the last image is third image expanded for you to see the problem: <img src="https://i.imgur.com/bfLaq.png" alt="image 4"></p> <p>Thanks for your attention.</p>
 

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