我正在做一个小项目,我目前正在尝试修复小的美学问题。在我的 GUI 构建期间(在我的 Galaxy S2 上,在 60-100 毫秒之间,在 onCreate 开始和 onResume 调用之间测量)是一个空白的白色活动,标题栏(我后来删除)可见。有什么好的办法可以摆脱这种小小的干扰吗?我想添加一个加载屏幕,但只闪烁一个十分之一秒似乎有点愚蠢。
我可以让屏幕保持黑色吗?或白色,只是阻止它绘制标题栏。
或者我可以让它立即闪烁徽标的图片吗?
想法将不胜感激:)
创建时:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
time = Calendar.getInstance().getTimeInMillis();
General.setAuthernticator(this);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.swipe_menu_layout);
//THIS IS THE "HEAVY" LIFTING
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setBackgroundColor(this.getResources().getColor(R.color.blue_0));
mIndicator.setFooterColor(this.getResources().getColor(R.color.blue_4));
mIndicator.setTextColor(this.getResources().getColor(R.color.blue_3));
mIndicator.setSelectedColor(this.getResources().getColor(R.color.blue_4));
mIndicator.setOnPageChangeListener(this);
if(!General.getBoolPref(General.VALUE_INSERTED_PREF)){
mIndicator.setCurrentItem(0);
}else{
mIndicator.setCurrentItem(1);
}
PTHandler.addTransactions();
Point outSize = new Point();
Display display = this.getWindowManager().getDefaultDisplay();
try {
// test for new method to trigger exception
Class pointClass = Class.forName("android.graphics.Point");
Method newGetSize = Display.class.getMethod("getSize", new Class[]{ pointClass });
// no exception, so new method is available, just use it
newGetSize.invoke(display, outSize);
}catch(NoSuchMethodException ex) {
// new method is not available, use the old ones
outSize.x = display.getWidth();
outSize.y = display.getHeight();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
outSize.x = 480;
outSize.y = 800;
}
GUI_attrs.setScreenSize(outSize.x, outSize.y);
}
简历:
@Override
public void onResume(){
super.onResume();
System.out.print("Draw time: " + (Calendar.getInstance().getTimeInMillis() - time) + ";\n");
}