Isn't it up to your layout to position and size the text view? If
you're getting 0 back, are you sure it's been laid out and is visible?
On Dec 3, 10:11 am, sweety <[EMAIL PROTECTED]> wrote:
> I did something like this within my code:
>
> public void test(){
> TextView tv = (TextView)findViewById(R.id.text_view);
> tv.setText("blablabla");
> int width = tv.getWidth();
> int height = tv.getHeight();
>
> }
>
> When test() is called(I am sure it's not called in the view or its
> parent's constructor), Both width and height is zero!!! How can get
> the width and height? Because the text might be quite long and be
> ellipsized by TextView so Paint.measureText() and Paint.getTextBound()
> can't fulfill this need.
>
> Anyone knows please help me. Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---