Change linear layout top margin programmatically android

后端 未结 7 1160
难免孤独
难免孤独 2021-02-01 02:31

i have two linear layouts in one frame layout.



        
7条回答
  •  感情败类
    2021-02-01 03:03

    use this

        layout = (LinearLayout) findViewById(R.id.layuout);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
             LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    
        layoutParams.setMargins(30, 20, 30, 0);
    layout.setLayoutParams(layoutParams );
    

提交回复
热议问题