niupi
   WindowManager wm = (WindowManager) getContext()
                .getSystemService(Context.WINDOW_SERVICE);
        int width = wm.getDefaultDisplay().getWidth();
        int height = (int) (width - 22*density) / 3;
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mLinearLayoutTrafficControl.getLayoutParams();
       lp.height = height;
       LinearLayout.LayoutParams lp2 = (LinearLayout.LayoutParams) mLinearLayoutTrafficControl2.getLayoutParams();
       lp2.height = height;
      LinearLayout.LayoutParams lp3 = (LinearLayout.LayoutParams) mLinearLayoutTrafficServicesBusinessOnline.getLayoutParams();
       lp3.height = height;

注解:先获取屏幕宽度,通过屏幕宽度获取布局的高度。

        density:是默认密度 private float density = 1.5f;

    

分类:

技术点:

相关文章:

  • 2021-12-27
  • 2021-11-30
  • 2021-12-19
  • 2021-12-05
  • 2021-11-29
  • 2021-12-31
  • 2021-12-23
  • 2021-11-23
猜你喜欢
  • 2021-12-05
  • 2021-12-10
  • 2021-11-29
  • 2021-11-30
  • 2021-11-29
  • 2022-01-07
  • 2022-01-12
  • 2021-12-09
相关资源
相似解决方案