在onCreate()回调中关于布局的信息很多都获取不到(应该是该声明周期执行的太早了,view还都没进行布局了),想问一下大家一般都是在activity的哪个声明周期获取布局信息的,或者有什么其他方法。
大家讲道理2017-04-17 17:44:21
Use view.post(Runnable r).
Essentially, it is to add the task to the execution queue of the view. When this logic is executed, the previous task of the view must have been executed, and then the correct measuredSize can be obtained
伊谢尔伦2017-04-17 17:44:21
Under Google, Android has several ways to obtain the width and height of View