Frage

i Java-Code schreibe eine tabs.i zu schaffen gemacht haben that.but jetzt will ich die Registerkarte Widget im unteren Teil der screen.i sein hoffen, dass dies, indem Sie diesen Code achived werden. android:layout_alignParentBottom="true" lassen Sie mich wissen, wie diese coding.i wollen wie dies ähnlich aussehen hinzufügen http://android-pro.blogspot.com/2010/08/iphone-like-tab-bar-in-android.html

TabHost TabHost = new 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();
War es hilfreich?

Lösung

Sie Ihr Layout mit XML ist es viel einfacher. Sie werden nach Maß Registerkarte Bilder benötigen, weil die Lager diejenigen sehen nicht direkt am unteren Rand des Bildschirms.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top