此代码给我错误:“在添加内容之前必须调用 requestFeature()”。现在我尝试在“setContent”之前和“setContent”之后调用 requestFeature 仍然出错。任何猜测:
public class Support extends TabActivity {
private ImageView mSpinnerImage = null;
private Animation mAnimation = null;
private Button button = null;
private TextView synctitle = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
/*Titlebar + Button*/
setContentView(R.layout.support);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
button = (Button) findViewById(R.id.syncbutton);
mSpinnerImage = (ImageView) findViewById(R.id.spinner_view);
mAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate_animation);
synctitle = (TextView) findViewById(R.id.synctitele);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
button.setVisibility(View.INVISIBLE);
mSpinnerImage.setVisibility(View.VISIBLE);
synctitle.setVisibility(View.VISIBLE);
mSpinnerImage.setAnimation(mAnimation);
mSpinnerImage.startAnimation(mAnimation);
}
});
/*Titlebar + Button ends*/
/*Tabs*/
Bundle bundle = getIntent().getExtras();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, TestListView.class);
spec = tabHost .newTabSpec("some_things")
.setIndicator("Info")
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, TestListView.class);
spec = tabHost .newTabSpec("top_things")
.setIndicator("Log")
.setContent(intent);
tabHost.addTab(spec);
tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 85;
tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 85;
/*Tabs ends*/
}
}