0
Ich folge dem offiziellen Android-Tutorial zum Einfügen von Wischen Tabs Layout in einem Fragment meiner Navigationsleiste.Wie wird das Tabulatorlayout innerhalb eines Fragments einer Navigationsleiste erstellt?
import com.example.android.supportv4.
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
/**
* This demonstrates how you can implement switching between the tabs of a
* TabHost through fragments, using FragmentTabHost.
*/
public class FragmentTabs extends FragmentActivity {
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_tabs);
mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
FragmentStackSupport.CountingFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
LoaderCursorSupport.CursorLoaderListFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"),
LoaderCustomSupport.AppListFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
}
}
Bitte helfen Sie mir zu verstehen, was die "R.id.realtabcontent" ist. Wie mache ich das XML-Layout dieses Fragments?
Abhängig von der Methode 'Setup'. Veröffentlichen Sie den Code dieser Methode und erklären Sie, was genau nicht funktioniert. – Vucko
gut..ein funktionierendes XML-Layout? –