Align arrow to the right of selected item

How can I align the Spinner "0dp arrow to the right of the currently selected Spinner element?

By default, Spinner finds the longest string and places it to the right of it. So how to find the current string and put it to the right of this?

The code I use to implement Spinner :

 ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(getSupportActionBar().getThemedContext(), R.array.main_navigation_list, R.layout.spinner_text); spinnerAdapter.setDropDownViewResource(R.layout.spinner_item); mNavigationSpinner = new Spinner(getSupportActionBar().getThemedContext()); mNavigationSpinner.setAdapter(spinnerAdapter); mNavigationSpinner.setOnItemSelectedListener(this); toolbar.addView(mNavigationSpinner); 

enter image description here

Any ideas help! Thanks you


This question is a duplicate that has never been answered. Dynamically position the right corner of the ActionBar Spinner arrow based on the length of the displayed title

+5
source share

Source: https://habr.com/ru/post/1210616/


All Articles