1
タイトルとスクロール可能なコンテンツを持つサイドメニューを作成したいと考えています。 私もいくつかのことを試してみました:タイトルとスクロール可能なコンテンツを持つツールバーのサイドメニュー
//that works: i can scroll in the content container and the status label stay on top but it's in my welcome form
Form welcome = new Form("Welcome");
welcome.setLayout(new BorderLayout());
Label welcomeStatusLabel = new Label("STATUS");
Container welcomeContent = new Container(new BoxLayout(BoxLayout.Y_AXIS));
welcomeContent.setScrollableY(true);
for(int i=0; i<20; i++)
welcomeContent.add(new Label("Item "+i));
welcome.add(BorderLayout.NORTH,welcomeStatusLabel);
welcome.add(BorderLayout.CENTER,welcomeContent);
は今、私は私のsidemenuで同じ動作をしたいと私はそれを試してみてください。
//that doesn't work: I can't scroll
Form menu= new Form("Menu");
menu.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
for(int i=0; i<20; i++)
menu.add(new Label("Item "+i));
welcome.getToolbar().addComponentToSideMenu(menu);
たぶん私は私のツールバーsidemenuでフォームを置くことができないので、私は、コンテナを試してみてください:
//that doesn't work: the status label will scroll with the content
Container menuContainer = new Container(new BorderLayout());
menuContainer.add(BorderLayout.NORTH,new Label("MENU STATUS"));
Container menuContent = new Container(new BoxLayout(BoxLayout.Y_AXIS));
for(int i=0; i<20; i++)
menuContent.add(new Label("Item "+i));
menuContainer.add(BorderLayout.CENTER,menuContent);
//if I uncomment these two lines the content won't scroll anymore on simulator. On android it scrolls with the status label
//menuContainer.setScrollableY(false);
//menuContent.setScrollableY(true);
welcome.getToolbar().getMenuBar().setScrollableY(false);//I don't know what that line does
welcome.getToolbar().addComponentToSideMenu(menuContainer);
多分私はサイドメニューでそれを行うべきではありませんか?または、私は正しいコンポーネントを使用しないかもしれませんか?
ご協力いただければ幸いです。
よろしくお願いいたします。
ジョナスは
Shaiさん、ありがとうございます。サイドバーの上に留まるにはそのタイトルが必要です。また、サイドバーのコンテンツを更新するため、移動するためのボタンも追加したいと考えています。多分、それは私がサイドバーでやっていることではないかもしれない。私は新しいフォームを作成する必要があります。私はデモをチェックしましたが、私が探しているものを見つけることができませんでした。 – Jonas
あなたが達成しようとしているもののスクリーンショットがある場合、私はより良い答えを提供するかもしれません。 –
これは私が達成したいものです: https://i.stack.imgur.com/8ooaN.png 実行時にスクロール可能な部分が更新される 静的部分は画面の上にとどまり、スクロールしない。 – Jonas