3

普通 Spinner 是这样的:

在此处输入图像描述

当我尝试使用 android:rotationY="180"所选项目旋转它时,它也被旋转似乎是合乎逻辑的

在此处输入图像描述

现在的问题是所选项目被旋转使得所选项目文本没有意义

所需的与第一张图片相同,但带有旋转的微调器

微调器 XML:

<Spinner  
     android:id="@+id/privacySpinner"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_below="@id/eventPrivacy"     
     android:layout_alignParentRight="@id/eventPrivacy"
     android:prompt="@string/event_privacy"
     android:entries="@array/privacy_levels"         
     android:rotationY="180"
/>
4

2 回答 2

1

通过选择“所选项目”来解决,因为它被称为视图(textView)然后将其旋转回来。选择的项目被旋转回来

  privacySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {


                public void onItemSelected(AdapterView<?> adapter, View view, int pos, long id) {

                  if(Locale.getDefault().getLanguage().equals("ar"))
                    view.setRotationY(180);// rotating the view (Selected Item) back 
                public void onNothingSelected(AdapterView<?> arg0) {
                }
            });

        }
于 2013-07-29T12:33:44.243 回答
0

Keep the rotation on the Spinner, but also add rotation on the textview you are using to display the text.

i.e. assign a View to the selected item, and set it's rotation back the other way.

pseudo:

spinner.setAdapter(...);
spinner.setDropDownViewResource(R.layout.my_view);

myView .. setRotationY = 180

ref http://developer.android.com/reference/android/widget/ArrayAdapter.html#setDropDownViewResource(int)

于 2013-07-29T11:35:12.127 回答