从充气和R.id不R.layout线性布局 [英] Inflate a linear layout from R.id and not R.layout

查看:200
本文介绍了从充气和R.id不R.layout线性布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里要疯了。我有一个片段的布局。里面我有除其他外与ID的LinearLayout中,比方说myLinearLayout。基本上,我要做到以下几点:

I'm going nuts here. I have a layout for a fragment. Inside I have among other things a LinearLayout with an id, say for example myLinearLayout. Basically, I want to do the following:

LinearLayout newLayout = new LinearLayout(this);
LinearLayout layoutCopy = inflatefrom(R.id.myLinearLayout);
newLayout.addView(layoutCopy);

我怎样才能做到这一点?

How can I do this?

推荐答案

试试这个:

View.inflate(Context, R.id, ViewGroup)

这篇关于从充气和R.id不R.layout线性布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆