简体   繁体   English

自定义微调器样式

[英]Custom spinner style

How can I style/customize spinner like shown below using xml? 如何使用xml设置样式/自定义微调器,如下所示? I can make white background with border, but i can't set icon on the left and arrow on the right. 我可以将白色背景设为带边框,但是我不能在左侧设置图标,而在右侧设置箭头。

在此处输入图片说明

If your problem is with a layout that sets the icon to the left and arrow to the right, the following should work. 如果您的问题出在将图标设置在左侧而将箭头设置在右侧的布局上,则应该可以进行以下操作。

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true" />

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/icon" />

    <ImageView
        android:id="@+id/arrow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true" />

</RelativeLayout>

I'm at work, so I can't test this out, but I think it should work. 我在工作,所以无法测试,但是我认为它应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM