开发者

Android Layout Questions

I tried to create an edittext textbox that will compute the width a开发者_C百科nd height automatically by using the WRAP_CONTENT way. However, at some point of time I will need the actual height of the edit text, but I tried using layout params and getWidth(), getHeight(), I am not being returned with the values I will require.

Anyone have got any idea how can I go about this?


You need to call view.layout() and then view.measure() in order for those values to be available to you prior to actual "layout" and display on the screen.

You need to be careful with wrap_content, though, because if your content is not already present in the view, it will not return the values you're looking for.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜