[英]Android - set layout label programmatically
如何以编程方式在XML中定义的LinearLayout中设置标签?
Inflate desired layout in the layout you want. 在您想要的布局中膨胀所需的布局。
Here is an example 这是一个例子
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.temp, null);
LinearLayout rl = (LinearLayout)findViewById(R.id.glavenfrejm);
LinearLayout.LayoutParams parametri = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
parametri.addRule(LinearLayout.ALIGN_PARENT_TOP);
rl.addView(v, parametri);
And this question has been answered thousands time. 这个问题已经回答了数千次。 Look around, more next time :) 环顾四周,下次更多:)
Cheers. 干杯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.