[英]my android spinner doesn't look fine
I need to customize my android spinner. 我需要自定义我的android微调器。 For this I created this spinner_selector.xml :
为此,我创建了以下spinner_selector.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/spinner_default" />
<item
android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/spinner_default" />
<item
android:state_pressed="true"
android:drawable="@drawable/spinner_pressed" />
<item
android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/spinner_focused" />
<item
android:state_enabled="true"
android:drawable="@drawable/spinner_default" />
<item
android:state_focused="true"
android:drawable="@drawable/spinner_focused" />
<item
android:drawable="@drawable/spinner_default" />
</selector>
and then set the background of spinner : android:background="@drawable/spinner_selector"
然后设置微调
android:background="@drawable/spinner_selector"
: android:background="@drawable/spinner_selector"
The problem is that the spinner looks really horrible. 问题在于,旋转器看起来真的很恐怖。 Before :
之前:
After : 之后:
and when it is pressed, it looks like this : 当按下它时,它看起来像这样:
The image that I use is this : 我使用的图像是这样的:
How to solve this? 如何解决呢? I have this problem for
Spinner
, Button
and EditText
too. 我也有
Spinner
, Button
和EditText
这个问题。 I really need to customize these components. 我真的需要自定义这些组件。 Please help.
请帮忙。 Any idea is welcome.
任何想法都欢迎。
为了使文本正确对齐,您可以在XML中使用padding
,请将“填充”提供给Spinner,例如: android:padding=5dp
问题似乎出在Spinner的高度和宽度上,您需要对其进行更改,可以提供任何静态值,也可以使用将图片大小设置为更大的换行内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.