using the 9 patch border sometimes works, sometimes gives half height repeated buttons.

62 views
Skip to first unread message

eos

unread,
Sep 5, 2013, 6:08:48 PM9/5/13
to codenameone...@googlegroups.com

When using the 9 patch, it sometimes works and we get the result we want.  e.g. below is something cut up (which we don't have the font for):



Then in the preview, it looks like this:

And on the device like this:



Once I did it and it worked exactly in both preview and on the device, but I wanted to change the cut lines slightly, so did exactly the same process again and it fails now. with the above result.  In both cases i just said "use a file", then set the markers- didnt change any other value (except possibly the auto Scale to DPI which I never know what to chose from - no idea if an iphone 5 (for which the images were made) is high, very high or hd for example.

The image is exactly the right size for the button (i.e. the width of the screen).

I have had this problem with most of the buttons I have cut - they end up half height, losing the text, or end up repeating when they should not.

Any ideas?



eos

unread,
Sep 5, 2013, 6:12:12 PM9/5/13
to codenameone...@googlegroups.com

Well, we got it to work once, but now no matter what we try, the button wont display (only a squashed shaddow of its former glory).  Looks like the border system is not working at all.

eos

unread,
Sep 5, 2013, 6:23:46 PM9/5/13
to codenameone...@googlegroups.com
I also tried setting the button as having an "IMAGE_SCALED_FIT" and various other options using the 599x90 image, and not using the border system.  Any use of the image as a background results in no button being displayed at all.  

Really really desperate for a way to have a button image, even if it only works on one handset.

Any suggestions?


eos

unread,
Sep 5, 2013, 6:26:24 PM9/5/13
to codenameone...@googlegroups.com
FYI, its just the S of a border layout which is fairly empty, in a container with a label which sits above it (box Y layout).  That container is the S of the Border.  If I just use a normal button of the default style, it works fine.  If I try ANY border or background image, I either get no button, or half a button.

Shai Almog

unread,
Sep 6, 2013, 12:35:18 AM9/6/13
to codenameone...@googlegroups.com
I suggest watching the image border wizard video.
You need to get the cutting lines close together.
You need to create a button without the arrows or the text and cut it with the guides close together, then place the arrows/text on the button.
Setting background options when you have an image border has no effect.

Clement Levallois

unread,
Nov 1, 2015, 5:18:38 PM11/1/15
to CodenameOne Discussions
Hi,
Sorry to unearth this old thread, but I have the same problem, and I have many similar feedback from students.
Basically, what I try to achieve is:
- using the Image Border wizzard to have rounded angles on a Button, and change its color.
 - these screenshots show that I try to do as the video explained, but I get the same effect. Help?





Shai Almog

unread,
Nov 1, 2015, 10:43:56 PM11/1/15
to CodenameOne Discussions
Hi,
that means the top/bottom lines are too far apart and you have a gradient in the center image.

Diamond

unread,
Nov 2, 2015, 4:00:22 AM11/2/15
to CodenameOne Discussions
Set the top line to 20 and bottom line to 19 if you are generating the image from rounded corner 150 x 40px.

20 + 19 = 39 - 40 = 1px which leaves no much room for image repetition. 

Side lines are usually not problematic, you can set them both to 11.

Clement Levallois

unread,
Sep 9, 2016, 11:06:03 AM9/9/16
to CodenameOne Discussions
Finally got it, thanks.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages