Layout orientation in code

后端 未结 6 1067
暗喜
暗喜 2020-12-25 09:38

I have this code in my application:

LinearLayout.LayoutParams params =
    new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);

and I

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-25 10:06

    You can't change LinearLayout's orientation using its LayoutParams. It can be done only with a LinearLayout object.

    LinearLayout layout = /* ... */;
    layout.setOrientation(LinearLayout.VERTICAL);
    

提交回复
热议问题