如何动态的设置Relative Layout中按钮的layout
展开全部
使用View.getLayoutParams代码访问 LayoutParams需要知道访问LayoutParams通通检查包含ViewGroup能知道LayoutParams类,应该使用LayoutParams类 案例RelativeLayout.LayoutParams应该使用RelativeLayout.LayoutParams#addRule(int verb)RelativeLayout.LayoutParams#addRule(int verb, int anchor) 通代码获: [java] view plain copy RelativeLayout.Layoutparams params = (RelativeLayout.LayoutParams)button.getLayoutParams(); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.LEFT_OF, R.id.id_to_be_left_of); button.setLayoutParams(params); //使layout更
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询