我正在开展一个小项目,我正在尝试修复小的美学事物。在我的GUI构建期间(在我的Galaxy S2上60-100ms之间,在onCreate和onResume调用之间测量)是一个空白的白色活动,标题栏(我后来删除)可见。是否有任何好的解决方案可以摆脱这种小干扰?我想添加一个加载屏幕,但是在十分之一秒内闪一下它似乎有点傻。
我可以将屏幕保持黑屏吗?或白色,只是不要画标题栏。
或者我可以让它立刻闪现一个标志的图片吗?
我们非常感谢您的想法:)
OnCreate中:
@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);
}
的onResume:
@Override
public void onResume(){
super.onResume();
System.out.print("Draw time: " + (Calendar.getInstance().getTimeInMillis() - time) + ";\n");
}