Android Spinner下拉图标被隐藏在背景图像下

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

[我在我的android应用程序中使用Spinner,在Spinner中使用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>
android xamarin.android dropdown android-spinner
2个回答
0
投票
更新

您可以尝试使用此代码吗?

<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>

0
投票
<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>

enter image description here

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