Hello,
I am trying a very simple GUI test :
[xml]<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
<screen id="GameHUDScreen" controller="fr.bewigame.dungeonexplorer.DungeonExplorer">
<layer id="GameHUDLayer" childLayout="center">
<panel id="GameHUDControls" valign="bottom" width="100%" height="20%" backgroundImage="Textures/GUI/fond_ui.png" childLayout="horizontal">
<image id="UpButton" filename="Textures/GUI/arrow_up.png" valign="bottom" align="right"></image>
</panel>
</layer>
</screen>
</nifty>[/xml]
I want the image to be aligned to the right on the panel. But the image stays on the left. Why ?
OK I have found the problem. I had to change childLayout=“horizontal” to childLayout=“center” on the panel.
1 Like
If you did need horizontal layout but right-aligned you can right align a horizontally laid out panel by putting an empty panel with width “*” at the start, this will expand to fill all available space and push everything else to the right.