Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LabeldPoint position is fixed #7

Closed
aldefy opened this issue Jan 17, 2014 · 2 comments
Closed

LabeldPoint position is fixed #7

aldefy opened this issue Jan 17, 2014 · 2 comments

Comments

@aldefy
Copy link

aldefy commented Jan 17, 2014

I have used

LabeledPoint p = new LabeledPoint( b, "Events: This is where all events and check-in happen" );
arrayListPoints.add( p );
p = new LabeledPoint(this,0.95f, 0.05f,"Use the Menu");
arrayListPoints.add( p );

Where b is a button;

but all my demo labeled points are defaulted to left hand side top corner of my activity what i'm a doing wrong.
Edit : calling my displaydemo in my onStart then also tried in oncreate

the "use the menu" is correct in its position, now for the fun part of this issue or my mistake:

when i inflate the overflow menu in my class with show demo again called its position is spot on

Please help

@aldefy
Copy link
Author

aldefy commented Jan 17, 2014

Found my own solution

For any one struggling

when u call the displaydemoifneeded method in onCreate put it like this :

new Handler().postDelayed( new Runnable() {
@OverRide
public void run() {
displayDemoIfNeeded();
}
}, 500 );

instead of simply calling displayDemoIfNeeded();

@aldefy aldefy closed this as completed Jan 17, 2014
@ericharlow
Copy link

A suggestion instead of a handler try this in your activities onCreate.

private void displayDemoOnLayout(int resourceId) {
    final View v = findViewById(resourceId);
    v.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            showDemoIfNeeded();
            v.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants