Search code examples
javaandroidlibgdxdropdownbox

libgdx Align text on selectbox


I´m trying to align the text of the selectbox on libgdx but i dont know how to do it. In the class an examples, setAligment is the option to do it, but in my android studio that option doesn´t exist, whent i try to put selectBox.setAlignment(Align.right); the setAlignment shows in red like the function doesn´t exist, the same problem with the selectBox.getList().setAlignment(Align.right); i´m using the 1.9.6 version of libgdx, i suppoused the version doesn´t have that functions anymore, but then how i can align the text?


Solution

  • setSelectedAlignment in SelectBox and setListAlignment in List are added on 9-Apr-2017, there is a PR for the same.

    I am sure you're using some older build of version 1.9.6, use latest build that deployed on 6-July-2107.

    If you're using gradle in your project then you need re-download dependencies:

    Generally, you can refresh dependencies in your cache with the command line option --refresh-dependencies. You can also delete the cached files under ~/.gradle/caches. With the next build Gradle would attempt to download them again.

    ./gradlew build --refresh-dependencies
    

    or use without build ./gradlew --refresh-dependencies

    You have to be noted that since gradle will try to download all dependency file, it takes time long.


    Or you can use SNAPSHOT version, update snapshot version in build.gradle of your root project.

    gdxVersion = '1.9.7-SNAPSHOT'