Mixed layouts in TopBottom bar. #2025
-
Beta Was this translation helpful? Give feedback.
Answered by
MichaelGrupp
Dec 22, 2024
Replies: 1 comment
-
You can put the contents in a egui::containers::TopBottomPanel::top("Bar").show(ctx, |ui| {
ui.horizontal(|ui| {
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min), |ui| {
ui.add(Label::new("Time"));
});
ui.with_layout(egui::Layout::right_to_left(egui::Align::Min), |ui| {
ui.add(egui::Image::new(
egui::TextureId::from(&gold_icon),
gold_icon.size_vec2(),
));
ui.add(Label::new("Gold"));
ui.add(egui::Image::new(
egui::TextureId::from(&food_icon),
food_icon.size_vec2(),
));
ui.add(Label::new("Food"));
});
});
});
`` |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
syedtaz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can put the contents in a
ui.horizontal()
layout and put your layouts inside (reordered to first have left to right, then the right one). This solved the same issue in my case. For your code example, this would be: