Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 47
Registered: ‎01-26-2011
My Device: Not Specified
Accepted Solution

Blank space when using onClick

So I am testing this on the simulator, but for some reason when I create a Button or even an ImageView, there seems to be extra space to the right of it. 

 

The extra space is about 30-40 pixels worth to the right. I want the bounds of the onClick to be exactly till the edges of the Button or ImageView, not any further.

 

Is it soppose to have this extra, invisable space next to these components? I have all my margins set to 0, and even the padding set to 0. Not sure why it's acting like this.

 

Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Blank space when using onClick

Can you post a sample of the code that does this behaviour? It can be difficult to control the width of buttons but it should be easy to control the width of an ImageView. 

 

Scott

Developer
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10

Re: Blank space when using onClick

Yeah the space is there.  I never noticed it before.  Just a simple Button with onClicked has it. No other special code.  Even when you use preferredWidth, the clicking area is wider than the button.

Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Blank space when using onClick

I see. If you really need this turned off, I would try placing a small 1x1 container with onClick defined on all sides where you don't want the overflow from the button to occur. Place the image right next to it so it's touching the button. I think this will stop the touch boundary from the button from overflowing around it because there will be touchable areas in the immediate space around it.

 

This is a hack but I think it might work.

 

Scott