부모 레이아웃으로 탭보기를 사용중인 새 응용 프로그램을 개발 중입니다. 내 응용 프로그램 내에서 3 탭을 표시하려면 TabHost를 사용하고 있습니다. 각 탭에는 ListView가 포함 된 별도의 Activity가 있습니다. 이것은 잘 작동합니다. ListView 내에서 항목을 클릭하면 현재 TabHost를 벗어나는 새로운 활동 전체 화면이로드됩니다. TabHost 내에서 이러한 활동을로드하고 싶습니다. 목록보기에서 다른 활동을 호출 한 후에 탭보기를 유지하려고합니다.tabview 내 목록 활동에서 새 활동을 시작하는 방법
답장을 보내 주셔서 감사합니다. 여기에 내 도움이 필요하다. 고객, 회사 및 도시 -
################ HelloTabWidget//이 클래스는 3 탭 탭보기를 표시합니다.
public class HelloTabWidget extends TabActivity {
//public class HelloTabWidget extends ActivityGroup {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, CustomerTabView.class);
spec = tabHost
.newTabSpec("Customer")
.setIndicator("Customer",
res.getDrawable(R.drawable.ic_tab_Customer))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, CompanyTabView.class);
spec = tabHost
.newTabSpec("Company")
.setIndicator("Company",
res.getDrawable(R.drawable.ic_tab_Company))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, CityTabView.class);
spec = tabHost
.newTabSpec("City")
.setIndicator("City", res.getDrawable(R.drawable.ic_tab_City))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}
################ 고객 이름의 CustomerTabView
//이 클래스를 표시 목록보기. 목록의 항목을 클릭하면 동일한 탭보기를 유지하면서 고객 정보 페이지가 열립니다.
public class CustomerTabView extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] category = getResources().getStringArray(
R.array.category_array);
setListAdapter(new ArrayAdapter<String>(this, R.drawable.list_items,
category));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//Need this logic where I can retain the tab view and call new activity class for customerdetails view.
Intent intent;
intent = new Intent(CustomerTabView.this,
C_DetailActivity.class);
startActivity(intent);
finish();
}
});
}
}
################ C_DetailActivity customertabview에서 모든 항목의 클릭에
이 활동 클래스는 고객의 세부 사항을 표시하는 전화를 가져옵니다.
public class C_DetailActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
textview.setText("This is the Customer Details view");
setContentView(textview);
}
}
C_DetailActivity 클래스를 호출 한 후 탭보기가 사라집니다. 기본 탭보기를 유지하려고합니다. 내가 탭보기를 유지하고 전화 새로운 활동 클래스를 customerdetails 테스트하지
간단하게하십시오. 나는 이것을하지 않을 것이다. – Blundell
코드를 게시 하시겠습니까? 이것은 쉬운 구현이어야합니다. –
그 밖의 무엇이 필요합니까? 너는 의도가 있니? –