FrameLayout margin not working

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

My layout structure is like this

LinearLayout
    FrameLayout
       ImageView
       ImageView
    FrameLayout
    TextView
LinearLayout

I

7条回答
  •  失恋的感觉
    2020-12-04 10:00

    add your xml this attribute and re run

    android:layout_gravity="top"

    everything is Ok!

    and you dont set new layout params like this;

    FrameLayout.LayoutParams llp = new FrameLayout.LayoutParams(WallpapersActivity.ScreenWidth/2, layH);
    

    use like this:

    FrameLayout.LayoutParams llp = (LayoutParams) myFrameLay.getLayoutParams();
    llp.height = 100;
    llp.width = 100;
    myFrameLay.setLayoutParams(llp);
    

提交回复
热议问题