You can inflate its views by doing:
LayoutInflater inflater = (LayoutInflater)context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(...);
Alternatively, you can simply create a view like
final LinearLayout l = [...]
//add stuff
l.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
//etc...
solved XML to Java code in Android [closed]