0
내 응용 프로그램에서 TabHost를 사용하고 있으며 2 개의 다른 탭에 2 개의지도를 표시해야합니다. 나는지도를 통합 할 수 있었지만 한 탭에서 다른 탭으로 이동할 때 문제가 발생했습니다.지도가 멈추거나 응답하지 않아 즉지도가 화면 중 하나에서만 작동합니다.문제가있는 여러지도가있는 TabHost를 사용하는 Android 앱
다음은 기본 레이아웃에 대한 xml과 클래스입니다. 나는 많은 사람들이 같은 문제에 직면하고 있지만,에 사용할 수있는 적절한 솔루션이없는 본
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff0000" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff0000"
>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#f00"
android:foregroundGravity="top"
android:layout_above="@android:id/tabs"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#fff"
android:tabStripEnabled="false"
>
</TabWidget>
</RelativeLayout>
</TabHost>
package com.cotechnica.alps;
import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.Menu;
import android.widget.TabHost;
import com.ankitkedia.alps.R;
public class Main extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, Map1.class);
spec = tabHost.newTabSpec("home").setIndicator("Map1",
getResources().getDrawable(android.R.drawable.star_on)).setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, Map2.class);
spec = tabHost.newTabSpec("rescue").setIndicator("Map2",
getResources().getDrawable(android.R.drawable.star_big_off)
).setContent(intent);
tabHost.addTab(spec);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
을 TabHost있다한다.
어떤 도움을 주시면 감사하겠습니다
, 내가
참고 [좋은 솔루션을
안부, ANKIT를 필요한 경우 샘플 프로젝트 소스를 보낼 수 링크 - 유일한 답변] (http://meta.stackoverflow.com/tags/link-only-answers/info)은 권장되지 않으므로 SO 답변은 솔루션 검색의 종점이어야합니다 (참조의 또 다른 중간 기착, 어떤 경향이있다. 에일). 링크를 참조 용으로 유지하면서 독립형 시놉시스를 여기에 추가하는 것을 고려해보십시오. – kleopatra
글쎄, 이것은 대답이기 때문에 당신이 여기에 두는 것보다 낫다. 고마워 ~ – user2558869