Change Relative layout width and height dynamically

后端 未结 7 1169
眼角桃花
眼角桃花 2020-12-14 09:30

Hi i am using following layout structure inside LinearLayout



        
7条回答
  •  忘掉有多难
    2020-12-14 09:40

    I faced this problem, the best solution for Change Relative layout width and height dynamically like this

    RelativeLayout relMain = (RelativeLayout) convertView.findViewById(R.id.relMain);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.width =200;
     params.height =200;
     params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            relMain.setLayoutParams(params);
    

提交回复
热议问题