Android利润率弹出式下降微调器

时间:2019-10-07 02:42:15

标签: android user-interface drop-down-menu spinner dropdown

我想要这样的东西:

wantedSituation

但是我现在有这个结果: CurrentSituation

实际上有1个问题,我想应用margin top de dropdown弹出窗口。 我尝试了一件不起作用的事情: popupTheme 有我的微调器:

<androidx.appcompat.widget.AppCompatSpinner
                android:popupBackground="@color/bgChoicesSpinner"
                android:popupTheme="@style/popupOverlay"
                android:dropDownWidth="match_parent"
                android:layout_marginTop="30dp"
                android:layout_marginStart="5dp"
                android:id="@+id/spinnerCountry"
                android:layout_width="match_parent"
                android:layout_height="50dp">

有我的风格:

<style name="popupOverlay" parent="ThemeOverlay.AppCompat.Light">
        <item name="android:layout_marginTop">10dp</item>
        <item name="android:background">@color/bgChoicesSpinner</item>
    </style>

2 个答案:

答案 0 :(得分:1)

使用android:dropDownVerticalOffset="xxdp"属性。

   <androidx.appcompat.widget.AppCompatSpinner
        android:spinnerMode="dropdown"
        android:dropDownVerticalOffset="40dp"
        ...
        />

enter image description here

答案 1 :(得分:0)

使您的微调框宽度如下图所示。为此,您需要使用一个父视图,并将微调器和下拉箭头放在该父视图上。确保您的微调框宽度可以实现实际的图像视图。

enter image description here