In my code i m trying to find the height the textview occupies..
I used OnGlobalLayout for that ..
here is my code

public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
t = new TextView(this);
ViewTreeObserver vto = t.getViewTreeObserver();
vto.addOnGlobalLayoutListener(this);
t.setText("This is to test the text\n Some Text \n Another ..");
t.append("\nafter something");
Toast.makeText(this, " The value at num =
"+num,Toast.LENGTH_SHORT).show();
setContentView(t);
}

public void onGlobalLayout() {    num=t.getHeight();
Toast.makeText(this, "Hellooo !! height is "+num,
Toast.LENGTH_SHORT).show();
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to