android 动态设置 WebView 的宽高

DisplayMetrics dm = new DisplayMetrics();//获取当前显示的界面大小
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        int width=dm.widthPixels;
        int height=dm.heightPixels;//获取当前界面的高度
        LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) wv.getLayoutParams(); 
        linearParams.height = height;
        wv.setLayoutParams(linearParams);


你可能感兴趣的:(android)