Android margin popup drodown spinner

问题描述 投票:1回答:2

我想要这样的东西:

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>
android user-interface drop-down-menu spinner dropdown
2个回答
1
投票

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

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

enter image description here


0
投票

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

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.