当前位置:操作系统 > 安卓/Android >>

Android中在OnCreate时获得控件高度

 

ViewTreeObserver vto = mArrowUp.getViewTreeObserver(); 

        vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { 

            @Override 

            public void onGlobalLayout() { 

                mArrowUp.getViewTreeObserver().removeGlobalOnLayoutListener(this); 

                Log.e("Width",Integer.toString(mArrowUp.getWidth())); 

                 

 

 

            } 

        });   

 

摘自 欧阳天涵的专栏

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,