Android View align bottom (programmatically) without XML

后端 未结 4 1700
春和景丽
春和景丽 2021-01-01 17:52

I got a problem with setting aligning my view programatically to the bottom of the screen. Basically I just want to place my admob advert at the screen bottom. I can\'t do i

4条回答
  •  情书的邮戳
    2021-01-01 18:38

        ImageButton buttonAdvance = new ImageButton(this);
        RelativeLayout.LayoutParams params = new       RelativeLayout.LayoutParams(160, 160);
        params.leftMargin = 5;
        params.bottomMargin = 4;
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        buttonAdvance.setLayoutParams(params);
    

提交回复
热议问题