0

私は TabSpec を使用してタブとそのナビゲーションを実装しています....テクノロジー、政治、スポーツの 3 つのタブがあります...それぞれに 1 つのクラスとそれぞれに 1 つのレイアウト (xml ファイル) を作成しました..しかし、.setIndicator はありません(string,XmlResourceParse) を引数として取る...どのメソッドを使用できますか?? mainactivity の私のコードは

package com.example.tabtest;

 import android.app.TabActivity;
 import android.content.Intent;
  import android.content.res.Resources;
  import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.widget.TabHost;
 import android.widget.TabHost.TabSpec;

      public class TabTestMainActivity extends TabActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_test_main);

    Resources ressources = getResources(); 
    TabHost tabHost = getTabHost(); 

    //Technology tab
    Intent intentTech=new Intent().setClass(this,Technology.class);
    TabSpec tabSpecTech=tabHost
    .newTabSpec("Tech")         
    .setIndicator("",ressources.getLayout(R.layout.activity_technology)) //passing xml
                                                                               //  resourceParser
    .setContent(intentTech);   


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.action_bar, menu);
    return super.onCreateOptionsMenu(menu);
}

   }

TabSpec の他の方法を検索しました...しかし、どれをどのように実装すればよいかわかりません....

4

0 に答える 0