[英]Android - How to force spinner dropdown to open right-aligned
On an app that I am working on, I have a small spinner on the right hand side of the screen. 在我正在开发的应用程序上,我在屏幕的右侧有一个小微调框。
The problem is that on some devices the spinner dropdown opens right-aligned, while on others the spinner dropdown opens left-aligned, with the text coming off the screen. 问题是,在某些设备上,微调框下拉列表以右对齐方式打开,而在其他设备上,微调框下拉列表以左对齐方式打开,文本从屏幕上移出。
I would like to know, is there a way to force the spinner dropdown to open right-aligned on all devices to prevent the text from coming off the screen? 我想知道,是否有一种方法可以强制微调器下拉列表在所有设备上打开右对齐以防止文本从屏幕上消失?
EDIT: Here is the XML for the Spinner: 编辑:这是微调器的XML:
<Spinner
android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="@+id/reportList"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="25dp"/>
For resizing the Spinner's window this solution was propposed in a different question. 为了调整Spinner窗口的大小, 此解决方案提出了另一个问题。
The question was asked in Spanish but see the answer of Jorgesys that uses reflection. 该问题以西班牙语提出,但请参见使用反射的Jorgesys答案。 Perhaps it puts you on the right path.
也许它使您走上正确的道路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.