Skip to content Skip to sidebar Skip to footer

Inflating Views Android

I have this main.xml layout which has a fixed header and footer. The body content has to change based on the parameters received. &

Solution 1:

Here is an example of inflating, hope this is what you need.

  LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflater.inflate(R.layout.temp, null);
        RelativeLayout rl = (RelativeLayout)findViewById(R.id.glavenfrejm);
        RelativeLayout.LayoutParams parametri = new  RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
        parametri.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        rl.addView(v, parametri);

Post a Comment for "Inflating Views Android"