Log in or register to post comments

Moving an Android Button depending on where is the AR.

August 31, 2012 - 2:53am #1

Hi,

I would like the user of my application to click on AR.

For that, i have been able to get in Java the coordinates of the AR (from the function renderFrame in the matrix modelViewProjection (data[12] and data[13]).

But I can't move the Android button (even with setHeight / setLeft / setBottom).

_dynamicButton.setClickable(true);<br />                _dynamicButton.setOnClickListener(listenerInfoApplicationButton);<br />                _dynamicButton.setText("x="+coordAR[0]+" y="+coordAR[1]);<br />                _dynamicButton.setLeft(coordAR[0]*200);<br />                _dynamicButton.setHeight(coordAR[0]);

The text of the button is ok, it changes but the button does'nt move...

Any idea?

Thanks in advance

Moving an Android Button depending on where is the AR.

September 11, 2012 - 8:27am #3

I think you can "hack" it by using margins. Set button in a relative layout top left then change the margins depending on where the trackable is

eg:

setLeftMargin(trackable x position in screen space)

set topMargin(trackably y position in screen space)

This is a hacky way of doing its what i ususally use for most of my positioning problems.

Moving an Android Button depending on where is the AR.

September 7, 2012 - 12:29pm #2

Is the button in a layout? If so, perhaps its position is contrained.

Log in or register to post comments