开发者

How to determine the View size right after Activity has been started

开发者 https://www.devze.com 2022-12-21 02:56 出处:网络
I want to do some data processing (in a thread) right after my main Activity starts. For that data processing to be started I also need to know a visible size of my main View (which is a LinearLayout

I want to do some data processing (in a thread) right after my main Activity starts. For that data processing to be started I also need to know a visible size of my main View (which is a LinearLayout currently, b开发者_运维知识库ut whatever).

I wonder how to do that. I.e. I wonder what is the entry point (callback?) I should use to be sure that my main View has been layed out, so i can use view.getWidth/getHeight?

Is creating a custom View and reimplementing it's onSizeChanged() - the only way? In this case how should I properly describe it in my xml layout file? (it will contain some child views)

Thanks in advance.


You can handle it in Activity#onWindowFocusChanged

0

精彩评论

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