Is it possible to change the layout width and height in Android at run time?

后端 未结 5 1835
不思量自难忘°
不思量自难忘° 2021-01-01 16:22

I have two relative layouts. Both have width of fill parent and height of 100 dip. My requirement is when I click the first layout it should shrink to 50dip height and the o

5条回答
  •  春和景丽
    2021-01-01 17:12

    These supply parameters to the parent of this view specifying how it should be arranged. There are many subclasses of ViewGroup.LayoutParams and these correspond to the different subclasses of ViewGroup that are responsible for arranging their children.

    So basically, if you are adding a view to another, you MUST set the LayoutParams of the view to the LayoutParams type that the parent uses or you will get a runtime error.

提交回复
热议问题