큰 문제가 있습니다. 내 앱을 시작하거나 열려면 거의 3 초가 걸립니다. 이 3 초 동안 나는 검은 화면 만 봅니다. 이 블랙 스크린에 대한 몇 가지 문제점을 알고 있지만 모두 문제는 아닙니다.앱이 BlackScreen으로 시작하는 데 오랜 시간이 필요합니다.
traceview를 실행하면 onCreate가 2 초 이상 필요합니다. 저보다 더 깊이 가서 TabHost의 addTab은 2 초 이상 필요합니다.
addTab은 각 탭의 각 활동에 대한 onCreate도 호출합니까 ?? 또한 Custom_title_bar가 있지만 custom_title을 제거한 후에 2-3 초가 필요합니다.
그럼 누구 한테 내가 뭘 할 수 있을지 생각해? 정말 각 탭마다 다른 활동이 필요하므로 활동을 제거하고보기를 사용할 수 없습니다.
스레드/AsyncTask에서 TabBar를 초기화하고 완료 한 후 MainActivity를 무효화 할 수 있습니까?
덕분에 많이와 greetz - 미르코
편집 :
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main_activity);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
Intent intent = new Intent(MainActivity.this, A.class);
setupTab(R.string.tab_a, R.drawable..., intent);
intent = new Intent(MainActivity.this, B.class);
setupTab(R.string.tab_b, R.drawable..., intent);
intent = new Intent(MainActivity.this, C.class);
setupTab(R.string.tab_c, R.drawable..., intent);
intent = new Intent(MainActivity.this, D.class);
setupTab(R.string.tab_d, R.drawable..., intent);
intent = new Intent(MainActivity.this, E.class);
setupTab(R.string.tab_e, R.drawable..., intent);
mTabHost.setCurrentTab(0);
SetupTab :
private void setupTab(int labelRes, int iconRes, Intent intent) {
String tag = (String) getText(labelRes);
mSpec = mTabHost.newTabSpec(tag)
.setIndicator(createTabIndicator(this, tag, iconRes))
.setContent(intent);
mTabHost.addTab(mSpec);
}
private View createTabIndicator(Context context, String title, int icon) {
LinearLayout indicator = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.tab_indicator, null);
TextView label = (TextView) indicator.findViewById(android.R.id.title);
if(title == null) label.setVisibility(View.GONE);
else label.setText(title);
ImageView tabicon = (ImageView) indicator.findViewById(android.R.id.icon);
tabicon.setImageResource(icon);
return indicator;
}
여기는 MainActivity 내에서 onCreate에서 일어난 무엇 처음에는 약간의 코드 조각을 추가
또한 내 응용 프로그램에 사용자 지정 테마를 설정했습니다. traceview에서 tabhost.addTab() 메서드는 2000 밀리 초 이상 필요합니다. 어쩌면 이것이 내가 블랙 스크린을 오랫동안 보았던 이유입니다.
누군가 BlackScreen이있는 이유를 알고 있습니까? 나는 정상적인 다른 응용 프로그램을 opan 때 BlackScreen이 없다고 생각합니다. BlackScreen을 변경하는 방법을 안다. 테마의 안드로이드 : 배경을 다른 것으로 설정하지만 시간 문제를 해결하지는 못한다.
SplashScreen을 추가했지만 앱이 시작될 때 검은 색 화면이 나타납니다 (단 몇 밀리 초). SplashScreen은 제목이없는 ImageView 및 full_screen의 활동입니다. 그것은 2 초를 기다리는 스레드를 시작하고 MainActivity를 열고 자신을 끝내는 것입니다.
고마워요.이 프로젝트에서 SplashScreen은 소원이며 아직 구현되지 않았습니다. 이제 BlackScreen이 나타나지만 몇 밀리 초 밖에 걸리지 않습니다. 블랙 스크린이 왜 있는지 모르겠습니다. 사용자 정의 테마가 그 이유라고 생각합니다. 나는 지금 약간의 코드를 추가 할 것이다. – Informatic0re