美好的一天,我有一个要求,我需要将布局(实际上是自定义Action_bar)包含到已创建的布局(在xml中完成),具体取决于发送的意图。即如果意图A发送,则包括布局。如果意图B发送,请不要。
我已经成功添加了可选布局:
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);
但问题是,如何将其作为布局中的第一个视图?..请随时提供任何帮助。感谢