私はブログのラタトゥユー - レストランコードを調べました。よかった。だから私はアプリにもそれを適用したいと思っていましたが、コンポーネントが追加されたときにスムーズなアニメーションを除いてすべて正常に動作します。私のコードで何が間違っていたのですか?前もって感謝します。animateLayoutがコンポーネントを展開していない - codenameone
protected void beforeTeamMemberTry(Form f) {
screenWidth = Display.getInstance().getDisplayWidth();
Container mainContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
f.add(mainContainer);
for (int i = 0; i < 3; i++) {
Container memberContainer = new Container(new BorderLayout());
memberContainer.getAllStyles().setMargin(5, 5, 0, 0);
mainContainer.add(memberContainer);
Label icon = new Label(theme.getImage("loginBg.png").scaledWidth(screenWidth/9));
icon.setName("memberIcon");
zeroPaddingMargin(icon);
memberContainer.add(BorderLayout.WEST, icon);
Container detailsContainer = new Container(new BorderLayout());
Container innerContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
detailsContainer.add(BorderLayout.CENTER, innerContainer);
innerContainer.setUIID("innerclkvjd");
zeroPaddingMargin(innerContainer);
innerContainer.getAllStyles().setPadding(10, 0, 10, 0);
innerContainer.getAllStyles().setAlignment(Component.CENTER);
detailsContainer.setName("detailsContainer");
zeroPaddingMargin(detailsContainer);
detailsContainer.getAllStyles().setAlignment(Component.CENTER);
memberContainer.add(BorderLayout.CENTER, detailsContainer);
Button email = new Button("[email protected]");
email.setName("memberEmail");
zeroPaddingMargin(email);
innerContainer.add(email);
Label position = new Label("Senior member".toUpperCase());
position.setName("memberPosition");
zeroPaddingMargin(position);
position.getAllStyles().setFgColor(0xccccc0);
position.getAllStyles().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));
innerContainer.add(position);
Label emblemDown = new Label(">");
emblemDown.setUIID("emblemDown");
memberContainer.add(BorderLayout.EAST, emblemDown);
Label emblemUp = new Label("<");
emblemUp.setUIID("emblemUp");
Container descriptionContainer = new Container();
TextArea descriptionTextArea = new TextArea("slkdjfdlk dslkfdslkf jsdfksdl fksd flksd f;lsdkf sldkf sdlfk s;dl fksdl fksd flsd fkds");
descriptionContainer.add(descriptionTextArea);
descriptionTextArea.setName("memberDescription");
zeroPaddingMargin(descriptionTextArea);
descriptionTextArea.setEditable(false);
descriptionTextArea.setGrowByContent(true);
descriptionTextArea.setGrowLimit(5);
memberContainer.setLeadComponent(email);
email.addActionListener(e -> {
if (emblemDown.getParent() != null) {
memberContainer.add(BorderLayout.EAST, emblemUp);
memberContainer.add(BorderLayout.SOUTH, descriptionContainer);
memberContainer.revalidate();
} else {
memberContainer.removeComponent(emblemUp);
memberContainer.add(BorderLayout.EAST, emblemDown);
memberContainer.removeComponent(descriptionContainer);
memberContainer.revalidate();
}
memberContainer.getParent().animateLayout(300);
});
}
}
phn番号を含む詳細。 (ボタン)descriptionContainer上記が、それはクリックできません。
Container descriptionContainer = new Container();
TextArea descriptionTextArea = new TextArea("slkdjfdlk dslkfdslkf jsdfksdl fksd flksd f;lsdkf sldkf sdlfk");
descriptionContainer.add(descriptionTextArea);
descriptionTextArea.setGrowByContent(true);
descriptionTextArea.setGrowLimit(2);
Container phnContainer = new Container();
descriptionContainer.add(phnContainer);
Label phnLabel = new Label("Phn: ");
Button phn = new Button("9802921323");
phnContainer.add(phnLabel);
phnContainer.add(phn);
phn.addActionListener(e->{
System.out.println("bibek calls");
});
ダイアモンドに感謝します。私はrevalidateを削除した後、それは働いた。しかし今、私は他の問題を抱えています、私はアドレスを表示する必要があります、phnいいえ。私はそれをクリックして詳細部分が出て行くので、私はアプリケーションから直接呼び出すphnのアクションリスナーを持つことはできません。私たちはそれをsmhowで動かすことができますか?上のコードを更新しました。お気軽に –
setLeadComponent()を削除してみてください。 – Diamond
leadcomponentを削除 – beck