[我在我的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>
您可以尝试使用此代码吗?
<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>
<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>