zoukankan      html  css  js  c++  java
  • 在代码中设置RelativeLayout布局中标签的android:layout_toLeftOf、android:layout_toRightOf等属性

     

    //转载一个布局文件,要向这个布局汇总动态添加一个button
    RelativeLayout relativeLayout(RelativeLayout)getLayoutInflater().inflate(R.layout.main,null);
    //装载要动态添加的按钮布局
    Button button = (Button)getLayoutInflater().inflate(R.layout.button,null);
    //创建一个LayoutParams对象
    
    RelativeLayoutLayoutParamslayoutParams= new RelativeLayout。LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
    
    layoutParams.addRule(RelativeLayout.RIGHT_OF,R.id.button1);
    
    layoutParams.addRule(RelativeLayout.BELOW,R.id.button);
    button.setLayoutParams(layoutParams);
    
    relativeLayout.addView(button);
  • 相关阅读:
    IEnumerable<T>接口主要成员
    SQL LinqToSql Lambda QA
    css网页布局兼容性有哪些要点与诀窍
    【转】解决大量图片造成的页面延迟
    C# override,new 的区别+C# 接口的显示实现和隐示实现
    ap_invoice_distributions_all到xla_ae_lines
    Mysql从索引原理对SQL分析优化实战
    如何实现IM表情、图片、文件之间的通讯?
    五步教你如何使用k8s快速部署ES
    ClickHouse MergeTree引擎的简单介绍
  • 原文地址:https://www.cnblogs.com/xgjblog/p/9755231.html
Copyright © 2011-2022 走看看