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. i.e if intent A sends, then include the layout. if intent B sends, don’t.
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
You can add the view using an index.
For example, the first view will be index 0.
See the doc.