【发布时间】:2015-06-23 07:34:15
【问题描述】:
我在布局中有一个带有微调器的片段。微调器 xml 是:
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spCategory"
android:spinnerMode="dialog"
android:dropDownWidth="match_parent"
android:prompt="@string/label_category_select" />
填充微调器是这样完成的:
List<Category> categories = categoryRepository.getAll();
CategoryAdapter adapter = new CategoryAdapter(this.getActivity(), categories);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spCategory= (Spinner)view.findViewById(R.id.spCategory);
spCategory.setAdapter(adapter);
CategoryAdapter 扩展了 ArrayAdapter,我使用 ViewHolder 模式。适配器使用这个自定义布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvSpinnerRowId"
android:visibility="gone">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tvSpinnerRowName">
</TextView>
</RelativeLayout>
问题是布局中的微调器高度延伸到屏幕底部。
我错过了什么?
【问题讨论】:
标签: android android-layout android-fragments