Android simple spinner item

Zuop picture Zuop · Sep 26, 2014 · Viewed 17.6k times · Source

this question relates to this one: android.R.simple_spinner_item

Since I can't comment because of low reputation, I have an additional question:

If I copy&paste the android.R.simple_spinner_item layout, I get an error on

android:layout_height="?android:attr/dropdownListPreferredItemHeight"

saying "error: Error: Attribute is not public. (at 'layout_height' with value '?android:attr/dropdownListPreferredItemHeight')."

I just added android:gravity="right" to get the spinner_item alignment to the right side.

How can I solve this error?

Answer

Daniel Wilson picture Daniel Wilson · May 23, 2015

Seems to work for me if you don't prefix it with android, like so:

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@android:id/text1"
             style="?android:attr/spinnerDropDownItemStyle"
             android:singleLine="true"
             android:layout_width="match_parent"
             android:layout_height="?attr/dropdownListPreferredItemHeight"
             android:ellipsize="marquee"/>