Android Layout: width half of parent

前端 未结 5 542
野的像风
野的像风 2021-02-02 06:36

I have a very simple layout that I can\'t make it looks like I want. It\'s a LinearLayout with a button and a Switch. I want them to show one above the other, but I want their w

5条回答
  •  半阙折子戏
    2021-02-02 07:00

    int params = linearLayout.getWidth()/2;
    
    ViewGroup.LayoutParams( params, ViewGroup.LayoutParams.WRAP_CONTENT));
    

提交回复
热议问题