【发布时间】:2015-12-01 13:52:31
【问题描述】:
我正在使用微调器:
<Spinner
android:id="@+id/spinner"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_alignBottom="@+id/text"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="@+id/text"
android:layout_toRightOf="@+id/text"
android:gravity="center|center_horizontal"
android:popupBackground="@color/spinner_pop"
android:spinnerMode="dropdown" />
上面的代码显示了一条消息Resouce id 0x1010081 is not of type STYLE (instead attr),但没有提到错误。
我已尝试运行此代码,布局完全按照我的意愿运行,我没有收到任何错误。
我已经搜索过了,但我找不到合适的解决方案来删除我的 xml 布局的图形布局视图中的消息。
这个https://stackoverflow.com/a/16588522/2508414 在我的项目中不起作用。
问题是,我目前的布局将来会产生任何问题吗?
我在 Eclipse Kepler 中运行它,Android API 级别 19。
应用将仅在 API 级别 16 及更高版本中运行。
编辑: 如果我将用于构建布局的 Api 级别更改为 20 及以上,则消息会消失。该消息仅在我使用 API 级别 19 及以下级别时显示。
【问题讨论】:
-
附上错误截图
-
@Survivor 我已经添加了屏幕截图。
-
android:popupBackground="@color/spinner_pop" android:spinnerMode="dropdown"删除此行后您是否尝试过? -
我的要求是 spinnerMode="dropdown",所以无法删除。虽然删除该行只能解决消息问题。
-
man 它在 API 级别 19 中不可用,因此如果您确实需要它,这会给您错误,然后以编程方式使用
// Creating adapter for spinner ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, categories); // Drop down layout style - list view with radio button dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // attaching data adapter to spinner spinner.setAdapter(dataAdapter);
标签: android android-layout android-spinner