0

現在、いくつかのタブがあるTabLayoutPanelがあり、各タブの中にはブレッドクラムのセットがあります。タブのすぐ横(TabBar自体の内側)にブレッドクラムを表示できるようにしたいと思います。誰かがこれを行った例はまだ見たことがなく、TabLayoutPanelクラスを自分で書き直して、必要に応じて実装することになるかもしれないと信じ始めていますが、代替手段がない限り、明らかにそのルートに行きたくないです。 。

誰かがこれについて何かガイダンスがありますか?

4

1 に答える 1

1

ちょうど同じ問題に遭遇しました。関連するコードスニペットのほとんどは次のとおりです。タブが選択されたときにUnicode矢印を追加し、タブが選択解除されたときにそれを削除しました。

    private final String htmlStr ="\u25bb";

        private String getTabTitle(String html){
        // Designed to work for this example input.
        //If you pass a different string you will need to do different matching.
        if(html.indexOf("\u25bb") < 0)
            return html;
        else
            return html.substring(html.indexOf("\u25bb")+1);
    }


    @Override
 public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
        if(!getSelectedIndex().equals(event.getItem())) {
            notifyCurrentTabOfClosing();
            selectedIndex = event.getItem();
            String tabtitle = getTabTitle(getTabBar().getTabHTML(selectedIndex));
            getTabBar().setTabHTML(selectedIndex, htmlStr+tabtitle);
            }
        }
    }

public void selectTab(Widget widget) {
        int widgetIndex = getWidgetIndex(widget);
        selectTab(widgetIndex);
        String tabtitle = getTabTitle(getTabBar().getTabHTML(widgetIndex));
        getTabBar().setTabHTML(widgetIndex, htmlStr+tabtitle);
    }
于 2011-07-11T16:10:41.210 に答える