2010-11-21 4 views
1

Ich schreibe Java-Code, um Tabs zu erstellen. Ich habe das getan. Aber jetzt möchte ich, dass das Tab-Widget im unteren Teil des Bildschirms angezeigt wird. Ich hoffe, dass dies durch Hinzufügen dieses Codes erreicht wird. android:layout_alignParentBottom="true" Lassen Sie mich wissen, wie Sie diese Codierung hinzufügen.Ich möchte, dass ähnlich aussehen http://android-pro.blogspot.com/2010/08/iphone-like-tab-bar-in-android.htmlWie Eltern Ausrichtung für Registerkarte TabWidget?

TabHost tabHost = neu TabHost (this);

tabHost.setLayoutParams(
      new LinearLayout.LayoutParams(
        LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 
    RelativeLayout rl=new RelativeLayout(ContactManager.this); 

    RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); 

    rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, android.R.id.tabs); 
    rl.setLayoutParams(rlp); 
    tabHost.addView(rl); 

    TabWidget tabWidget = new TabWidget(this); 
    tabWidget.setId(android.R.id.tabs); 
    rl.addView(tabWidget, new LinearLayout.LayoutParams(
       LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 

    FrameLayout frameLayout = new FrameLayout(this); 
    frameLayout.setId(android.R.id.tabcontent); 
    frameLayout.setPadding(0, 55, 0, 0); 


    rl.addView(frameLayout, new LinearLayout.LayoutParams(
       LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
    tabHost.setup(); 

Antwort

1

Machen Sie Ihr Layout mit XML viel einfacher. Sie werden benutzerdefinierte Tab-Bilder benötigen, weil die auf Lager befindlichen nicht direkt am unteren Bildschirmrand aussehen.

+0

danke! Ich habe das gemacht und die Ausgabe bekommen. – Ads

Verwandte Themen