I have two layouts: main.xml and buttonpanel.xml. In buttonpanel.xml, in main linearlayout I set gravity to bottom. Now i am trying to add the buttonpanel layout using the following code.
setContentView(R.layout.main);
LinearLayout layout=(LinearLayout)findViewById(R.id.mainlinearlayout);
LayoutInflater inflater= (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.buttonpanel,null);
layout.addView(view);
My problem is that the panel is added to the top though i have set gravity to bottom in buttonpanel.xml. If I add buttonpanel.xml to main.xml using include it works fine.
Can anyone help me what is the wrong with my code?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…