Toast getYOffset - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Toast getYOffset method.

This code example shows how to use the following methods:getXOffset, getYOffset, setGravity, show
        } 
 
        // inform users of how long the timeout is now 
        final String toast = makeTimeoutToastString(context, screenTimeout);
        mToast = Toast.makeText(context, toast, Toast.LENGTH_LONG);
        mToast.setGravity(Gravity.CENTER, mToast.getXOffset() / 2, mToast.getYOffset() / 2);
        mToast.show();
    } 
 
    @Override 
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
    } 
 
    @Override 
    protected boolean handleLongClick(Context context) {
        Intent intent = new Intent("android.settings.DISPLAY_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
7
CodeRank
This code example shows how to use the following methods:getXOffset, getYOffset, setGravity, show
        } 
 
        // inform users of how long the timeout is now 
        final String toast = makeTimeoutToastString(context, screenTimeout);
        mToast = Toast.makeText(context, toast, Toast.LENGTH_LONG);
        mToast.setGravity(Gravity.CENTER, mToast.getXOffset() / 2, mToast.getYOffset() / 2);
        mToast.show();
    } 
 
    @Override 
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
    } 
 
    @Override 
    protected boolean handleLongClick(Context context) {
        Intent intent = new Intent("android.settings.DISPLAY_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
6
CodeRank

Related Toast getYOffset Questions & Answers:

getYOffset Method Overview
Return the Y offset in pixels to apply to the gravity's location.
See Code Examples for other Android Toast Methods: