Frage

I have created number of LWUIT Tabs,when i display those tabs on my form Screen,i am able to see only 4 tabs on my form screen,remaining tabs are displaying but those are hiding,How to display my form with tabs userfriendly?

tabs.addTab("Tab1", newsList);
tabs.addTab("Tab2", myNewsList);
tabs.addTab("Tab3", cinemaNewsList);
tabs.addTab("Tab4", gossipList);
tabs.addTab("Tab5", list);
tabs.addTab("Tab5", list);


form1.addComponent(BorderLayout.CENTER, tabs);

form1.show();
War es hilfreich?

Lösung

It will differ based on the screen size. If your screen size is 240*320, it will show only 4 tabs. If your screen size is 320*240, it will show all 6 tabs.

You can do it in only one way by using buttons.

    int tabsCount = 6;

    Button btnOne = new Button(" Tab 1 ");
    btnOne.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);

    Button btnTwo = new Button(" Tab 2 ");
    btnTwo.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);

    Button btnThree = new Button(" Tab 3 ");
    btnThree.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);

    Button btnFour = new Button(" Tab 4 ");
    btnFour.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);

    Button btnFive = new Button(" Tab 5 ");
    btnFive.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);

    Button btnSix = new Button(" Tab 6 ");
    btnSix.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);


    tabs.addTab(btnOne, new Label("Tab one selected"));
    tabs.addTab(btnTwo, new Label("Tab Two selected"));
    tabs.addTab(btnThree, new Label("Tab three selected"));
    tabs.addTab(btnFour, new Label("Tab four selected"));
    tabs.addTab(btnFive, new Label("Tab five selected"));
    tabs.addTab(btnSix, new Label("Tab six selected"));

It won't display the text of the button fully in small screens. But, when that tab is focused that title will be displayed as ticker.

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