自定义微调器太薄

Custom Spinner too thin

我正在为我的 Spinner 创建一个自定义布局,其代码是这样的:

 <!-- spinner_item.xml -->
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:textSize="20sp"
        android:gravity="left"
        android:textColor="#FF0000"
        android:layout_marginTop="0dp"
        android:width="50dp"
        android:layout_marginBottom="40dp"/>

并按如下方式使用:ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list);

这是结果:

但是每个元素都太细了,所以我用了一个padding-top但是效果很差:

当我 select 其中之一时,它没有出现在框中(我认为这是因为它太宽了)。有没有办法做到这一点?谢谢。

使用填充而不是边距

 <!-- spinner_item.xml -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:textSize="20sp"
    android:gravity="left"
    android:textColor="#FF0000"
     android:padding="10dp"/>