Change Relative layout width and height dynamically

后端 未结 7 1167
眼角桃花
眼角桃花 2020-12-14 09:30

Hi i am using following layout structure inside LinearLayout



        
7条回答
  •  难免孤独
    2020-12-14 09:59

    From below code u can get device height and width:-

    Display display = getWindowManager().getDefaultDisplay();
        int width = (display.getWidth() );
        int height = (display.getHeight() );
    

    paramsTop ur realative layout:-

    Now u can set height or width what you want.

            paramsTop = new RelativeLayout.LayoutParams(width, height);
    

提交回复
热议问题