Android spinner下拉图标隐藏在背景图像下
我在android应用程序中使用Android spinner下拉图标隐藏在背景图像下,android,xamarin.android,dropdown,android-spinner,Android,Xamarin.android,Dropdown,Android Spinner,我在android应用程序中使用微调器,在线性布局中使用微调器,在图像背景中使用相对布局,在框架布局中使用显示背景图像。在本例中,我的下拉图标隐藏在背景图像后面。这里是我的示例代码 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="25px" android:minHeight="25px" and
微调器
,在线性布局
中使用微调器
,在图像背景中使用相对布局
,在框架布局
中使用显示背景图像。在本例中,我的下拉图标隐藏在背景图像后面。这里是我的示例代码
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:background="#FFFF"
android:layout_height="match_parent"
android:id="@+id/mainLinearLayout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:id="@android:id/background"
android:background="@drawable/devbg"/>
<LinearLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:id="@+id/linearLayout1">
<Spinner
android:id="@+id/dropStatus"
style="@style/Base.Widget.AppCompat.DropDownItem.Spinner"
android:theme="@style/CardView.Dark"
android:spinnerMode="dropdown"
android:layout_width="180dp"
android:layout_height="30dp"
android:layout_marginBottom="7dp"
android:layout_marginLeft="5dp"
android:textSize="16dp"
android:foregroundTint="#FF000000"
android:backgroundTint="#FF000000"
android:textAlignment="center"
android:drawSelectorOnTop="true"/>
</LinearLayout>
</FrameLayout>
已更新
你能试试这个代码吗
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:background="#FFFF"
android:layout_height="match_parent"
android:id="@+id/mainLinearLayout">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:id="@android:id/background"
android:src="@drawable/devbg"/>
<LinearLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:id="@+id/linearLayout1">
<Spinner
android:id="@+id/dropStatus"
style="@style/Base.Widget.AppCompat.DropDownItem.Spinner"
android:theme="@style/CardView.Dark"
android:spinnerMode="dropdown"
android:layout_width="180dp"
android:layout_height="30dp"
android:layout_marginBottom="7dp"
android:layout_marginLeft="5dp"
android:textSize="16dp"
android:foregroundTint="#FF000000"
android:backgroundTint="#FF000000"
android:textAlignment="center"
android:drawSelectorOnTop="true"/>
</LinearLayout>
</FrameLayout>
我不知道您为什么使用RelativeLayout
设置背景。删除它并在LinearLayout
中设置背景,一切正常
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:background="#FFFF"
android:layout_height="match_parent"
android:id="@+id/mainLinearLayout">
<LinearLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:id="@+id/linearLayout1"
android:background="@drawable/pink">
<Spinner
android:id="@+id/dropStatus"
style="@style/Base.Widget.AppCompat.DropDownItem.Spinner"
android:theme="@style/CardView.Dark"
android:spinnerMode="dropdown"
android:layout_width="180dp"
android:layout_height="30dp"
android:layout_marginBottom="7dp"
android:layout_marginLeft="5dp"
android:textSize="16dp"
android:foregroundTint="#FF000000"
android:backgroundTint="#FF000000"
android:textAlignment="center"
android:drawSelectorOnTop="true"/>
</LinearLayout>
</FrameLayout>
我的背景图像为白色,图标颜色为黑色,因为我在微调器的背景色调中设置了此颜色,所以图标在预览中显示为黑色。但不是在设备中。当我删除设备中显示的图像时。已尝试,但未显示下拉图标。它仅在我删除背景图像时显示。