PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Is there a way to align the selected item to the right? #219

Closed Jamiek94 closed 4 years ago

Jamiek94 commented 4 years ago

Is it possible to only align the selected item to the right on android? It seems to be aligned to the left. I've tried several CSS styles like text-align & horizontal-align, but without success.

image

AWhiteSheep commented 4 years ago

You could try textAlignment attribute DropDown textAlignment="right" . For more information, the container used to set your text ui is a Label so use one of the TextAlignment valid alignment https://docs.nativescript.org/api-reference/classes/_uilabel.label#textalignment

Jamiek94 commented 4 years ago

The textAlignment didn't work for me. I had to set the gravity;

 const dropdown = this.page.getViewById<DropDown>("countryId");
 dropdown.nativeView.setGravity(8388613); // means gravity END.