我只是想知道是否可以简单地删除微调器的下拉箭头?我的微调器的背景布局中有一个可绘制箭头,但是系统默认箭头出现在微调器的右侧,我想去掉它。
这是我的 Activity 布局的微调器 xml 代码
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spinnerSelectStaff"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="18dp"
android:layout_marginRight="18dp"
android:gravity="center"
android:dropDownSelector="@drawable/empty"/>
我的自定义微调器布局如下所示:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:textSize="20sp"
android:background="@drawable/spinner_text_shape"
android:drawableRight="@drawable/ic_keyboard_arrow_down_black_24dp"
android:textColor="@color/primary_text" />
谢谢!
最佳答案
如果您不想声明特定样式,则布局 xml 文件中的背景 @null 也可以解决问题:
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"/>
关于Android - 移除微调器下拉箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30588311/