首页 > 解决方案 > 如何在android studio中创建这样的微调器?

问题描述

https://i.stack.imgur.com/CmVdo.png

我想知道如何在 xml 中为这个微调器创建背景。

标签: androidandroid-spinner

解决方案


您可以为微调器创建一个自定义适配器,但有一个简单的方法是这样的

<Relativelayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background=your color>

<Spinner android:id="@+id/fragment_filter_sp_users"
         android:layout_width="match_parent"
         android:background="@color/colorTransparent"
           android:layout_toLeftOf="@+id/image"
         android:layout_height="wrap_content"/>

  <ImageView
       android:id="@+id/image"
         android:layout_alignParentRight="true"
        android:layout_marginBottom="@dimen/_5sdp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_arrow_bottom"
   />
  </Relativelayout>

推荐阅读