简体   繁体   English

Android-如何强制微调框下拉列表打开右对齐

[英]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.

相关问题 在Android上列出布局,如何使按钮右对齐? - List Layout on Android, how to make buttons right-aligned? Android - 使用右对齐视图进行布局椭圆化 - Android — Layout ellipsize with right-aligned view 如何在不重叠滚动条的情况下显示 Android 右对齐 ListItem 数据? - How to show Android Right-aligned ListItem data without overlapping the scrollbar? 带有右对齐检查按钮/框的Android CheckBox - Android CheckBox with right-aligned checking button/box 当屏幕宽度较小时,如何在右对齐按钮旁边省略居中对齐的文本视图 - How to ellipsize center-aligned textview beside a right-aligned button when screen width is small 具有右对齐,裁剪,未缩放内容的ImageView - ImageView with right-aligned, cropped, unscaled content ListView行样式 - 左对齐文本和右对齐图标 - ListView row styling - left aligned text, and right-aligned icon 如何为有一个TextView左对齐和一个TextView右对齐的ListView行创建XML布局? - How do I make an XML layout for a ListView row where there is a TextView left-aligned and a TextView right-aligned? RelativeLayout不会包装右对齐的TextView - RelativeLayout won't wrap right-aligned TextView 我想在android中创建自定义标签栏,标签必须右对齐,内容必须在左侧 - I want to create custom tab bar in android, The tabs must be right-aligned and contents must be at the left-side
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM