print View for debug - Android User Interface

Android examples for User Interface:View

Description

print View for debug

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static void printView(String msg, View v) {
        System.out.println(msg + "=" + v);
        if (null == v) {
            return;
        }/*ww w .  j  ava2 s .  c  o m*/
        System.out.print("[" + v.getLeft());
        System.out.print(", " + v.getTop());
        System.out.print(", w=" + v.getWidth());
        System.out.println(", h=" + v.getHeight() + "]");
        System.out.println("mw=" + v.getMeasuredWidth() + ", mh="
                + v.getMeasuredHeight());
        System.out.println("scroll [" + v.getScrollX() + ","
                + v.getScrollY() + "]");
    }
}

Related Tutorials