Skip to content

Mixed layouts in TopBottom bar. #2025

Answered by MichaelGrupp
syedtaz asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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::

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by syedtaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants