首页 > 解决方案 > Android微调器下拉图标隐藏在背景图像下

问题描述

Spinner在我的 android 应用程序中使用,我Spinner在 a中使用LinearLayout,我使用Relative Layout图像背景和LinerLayout内部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">
    <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>

标签: androidxamarin.androiddropdownandroid-spinner

解决方案


不知道你为什么用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>

在此处输入图像描述


推荐阅读