美文网首页
inflate 参数

inflate 参数

作者: 细雨么么 | 来源:发表于2021-11-09 11:47 被阅读0次

    框架尺寸是 200200 (wh) 颜色深蓝色

    解析尺寸根布局是 满100(wh) 颜色黄色
    小框框是 5050(wh) 颜色青色

       var fm=findViewById<FrameLayout>(R.id.frame_layout)
            val view=layoutInflater.inflate(R.layout.item_rv,null)
            Log.d("test","返回的布局的名字"+view.javaClass.simpleName)
            fm.addView(view)
    //返回的布局的名字LinearLayout
    
    image.png

      var fm=findViewById<FrameLayout>(R.id.frame_layout)
            val view=layoutInflater.inflate(R.layout.item_rv,fm,false)
            Log.d("test","返回的布局的名字"+view.javaClass.simpleName)
            fm.addView(view)
    //返回的布局的名字LinearLayout
    
    image.png

       var fm=findViewById<FrameLayout>(R.id.frame_layout)
            val view=layoutInflater.inflate(R.layout.item_rv,fm,true)
            Log.d("test","返回的布局的名字"+view.javaClass.simpleName)
    //        fm.addView(view)  //已经添加到布局中了 不能再次添加
    //返回的布局的名字FrameLayout
    
    image.png

    相关文章

      网友评论

          本文标题:inflate 参数

          本文链接:https://www.haomeiwen.com/subject/vwumzltx.html