【发布时间】:2019-08-25 01:42:30
【问题描述】:
但是,在默认情况下,它甚至不像一个微调器。知道如何改善它的外观吗?
代码如下:
adapter=new SpinAdapter(this,com.Orange.R.layout.spinnerrowlist,spinnerInfo);
adapter.setDropDownViewResource(com.Orange.R.layout.multiline_spinner_dropdown_item);
previousVisitCommentsSpinner.setAdapter(adapter);
spinnerrowlist.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#FFFFFF"
android:orientation="horizontal" >
<TextView
android:id="@+id/textview_spinner1"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:layout_alignParentLeft="true"
android:textColor="@drawable/textorange_selected" />
<TextView
android:id="@+id/textview_spinner2"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/textview_spinner1"
android:paddingLeft="5dp"
android:textColor="@drawable/textorange_selected" />
<TextView
android:id="@+id/textview_spinner3"
style="?android:attr/spinnerItemStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingLeft="5dp"
android:textColor="@drawable/textorange_selected" />
</RelativeLayout>
这里是微调器:
<Spinner
android:id="@+id/previousVisitComments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="@+id/previousvisit"
android:layout_marginTop="15dp"
android:background="@drawable/spinner_selector"
android:textColor="@color/medium_orange"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
微调器中的项目应该在同一行,这就是我使用水平布局的原因! 感谢您的回答!
【问题讨论】:
-
关键在 com.Orange.R.layout.spinnerrowlist,而不是下拉列表。现在看不到;如果我有空,我稍后会尝试查看它,但它正在尝试将文本压缩到一个小区域。
标签: android android-layout android-spinner