[英]Make android button look like a spinner
I have a buttons and I want to make them look like a spinner. 我有一个按钮,我想让它们看起来像个微调框。 I've found this post from 2011: Android: Drawing a button as a spinner 我发现这篇文章来自2011年: Android:画一个按钮作为微调器
And none of the solutions worked for me. 而且没有一种解决方案对我有用。
It's better if I could use my customed background. 如果可以使用自定义的背景,效果会更好。 Those are the buttons: 这些是按钮:
<Button
android:id="@+id/new_msn_act_type"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/button_border"
android:onClick="showPopup"
android:padding="6dp"
android:text="Order Type"
android:textColor="@color/colorPrimary" />
<Button
android:id="@+id/new_msn_datetimepick"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/button_border"
android:onClick="pickDateTime"
android:padding="6dp"
android:text="Date and Time"
android:textColor="@color/colorPrimary" />
I tried each one of the solutions suggested in the post, including 我尝试了帖子中建议的每种解决方案,包括
style="?android:attr/spinnerStyle"
And they didn't work. How can I solve it ? Thanks
I need it to be a Button, because I want to use drawable style as background, and I want it to open PopupMenu and I worked hard for the popup to present icons correctly... 我需要将它作为一个Button,因为我想使用可绘制样式作为背景,并且希望它打开PopupMenu,并且我努力使弹出窗口正确显示图标...
I solved it with: 我解决了:
android:drawableRight="@drawable/arrow_down_float"
You can also choose custom drawables 您还可以选择自定义绘图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.