我想扩展一个现有的活动来改变它的布局,我正在尝试这样做:
public class NewActivity extends ParentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_layout);
...
}
但它不起作用;旧版面出现!另一方面,如果我这样做:
public class NewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_layout);
...
}
然后它工作..为什么?
ParentActivity 的 onCreate():
@Override
public void onCreate(Bundle savedInstanceState)
{
setTitle(R.string.title_home);
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
....
}