[英]How to position views/layout programmatically in a linear layout
Good day, I have a requirement which i need to include a layout (actually a custom Action_bar) to an already created layout (that was done in xml) depending on which intent is being sent.美好的一天,我有一个要求,我需要根据发送的意图将布局(实际上是自定义 Action_bar)包含到已创建的布局(在 xml 中完成)中。 ie if intent A sends, then include the layout.
即,如果意图 A 发送,则包括布局。 if intent B sends, don't.
如果意图 B 发送,则不要发送。
i have successfully added the optional layout, by doing this:通过这样做,我已经成功添加了可选布局:
layout = (LinearLayout)findViewById(R.id.ad_linearlayout_id);
LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.actionbar_layout, null, true); //
layout.addView(view);
but question is, how do i make it the first view in the layout?.. Please any help will be highly appreciated as always.但问题是,我如何使它成为布局中的第一个视图?..如有任何帮助,我们将一如既往地受到高度赞赏。 Thanks
谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.