FrameLayout margin not working

后端 未结 7 1892
野的像风
野的像风 2020-12-04 09:46

My layout structure is like this

LinearLayout
    FrameLayout
       ImageView
       ImageView
    FrameLayout
    TextView
LinearLayout

I

7条回答
  •  难免孤独
    2020-12-04 10:15

    I had the same issue myself and noticed that setting the layout_ margins does not work until you also set your ImageView's layout gravity i.e. android:layout_gravity="top" in the XML resource file, or from code: FrameLayout.LayoutParams.gravity = Gravity.TOP;.

提交回复
热议问题