如何将Spinner
“箭头”0dp对齐到当前所选Spinner
项目的右侧?
默认情况下,Spinner
找到最长的string
,并将其置于右侧。那么,我如何找到当前的string
并将其置于右侧?
我用来实现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);
任何想法都有帮助!谢谢
这个问题是一个从未回答的副本。 Dynamically position right corner arrow of the ActionBar Spinner based on length of displayed title