0
4 개의 탭 탭이있는 Android 탭에서 간단한 탭 앱을 실행하려고합니다. 내 문제는 내가 아이콘 표시를 표시 할 때, 그냥 내가 tabhost에 당김 및 표시 텍스트를 표시하려면, 텍스트 만 표시를 표시한다는 것입니다,이 내 코드입니다 : 내가 사용하는 경우android : 탭 호스트에 표시기 텍스트와 드로어 블을 표시 할 수 없습니다.
@Override
protected void onCreate(Bundle savedInstanceState) {
//hide title bar
BasicDisplaySettings.toggleTaskBar(SimasCardMainActivity.this, false);
//show status bar
BasicDisplaySettings.toggleStatusBar(SimasCardMainActivity.this, true);
super.onCreate(savedInstanceState);
setContentView(R.layout.simascard);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, TerbaruSimasCard.class);
spec = tabHost.newTabSpec("Terbaru").setIndicator("Terbaru",
res.getDrawable(R.drawable.menu_terbaru))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, MerchantSimasCard.class);
spec = tabHost.newTabSpec("Merchant").setIndicator("Merchant",
res.getDrawable(R.drawable.menu_merchant))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, TentangSimasCard.class);
spec = tabHost.newTabSpec("Tentang").setIndicator("Tentang",
res.getDrawable(R.drawable.menu_tentang))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, FaqSimasCard.class);
spec = tabHost.newTabSpec("FAQ").setIndicator("FAQ",
res.getDrawable(R.drawable.menu_faq))
.setContent(intent);
tabHost.addTab(spec);
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++){
tabHost.getTabWidget().getChildAt(i).setPadding(0,0,0,0);
tabHost.getTabWidget().getChildTabViewAt(i).setBackgroundDrawable(null);
}
tabHost.setCurrentTab(0);
}
// @Override
public void onBackPressed() {
finish();
}
spec = tabHost.newTabSpec("Tentang").setIndicator("",
res.getDrawable(R.drawable.menu_tentang))
.setContent(intent);
아이콘이 표시되지만, setIndicator
같은 텍스트를 추가 할 때 setIndicator("Tentang")
과 같이 표시기 텍스트 만 tabhost에 표시됩니다. 내 코드에 문제가있는 곳을 모르지만 탭 높이를 늘리려고했습니다. ,하지만 그것은 작동하지 않습니다, 나는 누군가가 내 문제를 해결하는 데 도움이되기를 바랍니다. 당신은
심각하게 잘 작동 감사? 나는 그것이 작동 할 것이라고 생각하지 않는다 .... –
@AoyamaNanami 내 편집을 보아라. –