微调值对齐,而不是右左 [英] Align spinner values to right instead of left
本文介绍了微调值对齐,而不是右左的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在飞旋的XML,我使用的:
In spinner xml, I'm using:
android:entries="@array/cars"
,其中汽车是数字的产品清单。
where cars is list of numeric items.
微调器自动对齐值向左,我无法找到XML / code怎么改。
The spinner automatically align values to left, and I can't find in xml/code how to change it.
推荐答案
您必须使用自定义视图这里给对齐的微调值。创建一个CustomView像<一个href="http://stackoverflow.com/questions/2491980/how-to-color-and-alignment-spinner-item-on-android">this答案已经创建并添加机器人:重力
到TextView中的右键
You have to use a custom view here to give alignment to the Spinner values. Create a CustomView like this answer has created and add android:gravity
to the TextView as right
.
更新:
使用设置CustomView为您的适配器
Set the CustomView to your adapter using
adapter.setDropDownViewResource(android.R.layout.your_custom_created_view);
这篇关于微调值对齐,而不是右左的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文