Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
字幕在spinner Android中不起作用_Android_Spinner - Fatal编程技术网

字幕在spinner Android中不起作用

字幕在spinner Android中不起作用,android,spinner,Android,Spinner,在我的应用程序中,我尝试使用字幕功能,但它不起作用。我在一个旋转器中使用了它,我也看到了很多例子,它在旋转器中工作,但在我的例子中它不工作。在XML页面中,在我使用的Spinner标记下 android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" 在java页面中,我使用了这个 private void setStateListener(){ final Spinner s = (Spinner

在我的应用程序中,我尝试使用字幕功能,但它不起作用。我在一个旋转器中使用了它,我也看到了很多例子,它在旋转器中工作,但在我的例子中它不工作。在XML页面中,在我使用的
Spinner
标记下

android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"
在java页面中,我使用了这个

private void setStateListener(){
     final Spinner  s = (Spinner) findViewById(R.id.spinnerState);


         s.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
             public void onItemSelected(AdapterView<?> parent, View view,  int position, long id) {

                 s.setSelected(true); 
                //some code...
                        ...
                 }
              }
             public void onNothingSelected(AdapterView<?> parent) {
             }
         });

 }
private void setStateListener(){
最终微调器s=(微调器)findViewById(R.id.spinnerState);
s、 setOnItemSelectedListener(新的AdapterView.OnItemSelectedListener(){
已选择公共视图(AdapterView父视图、视图视图、整型位置、长id){
s、 已选择(正确);
//一些代码。。。
...
}
}
未选择公共无效(AdapterView父级){
}
});
}
Spinner显示结果没有任何问题,但是marquee没有处理它

我错在哪里

请帮忙

谢谢。

试试这个。。 将这行代码放在文本视图中

android:layout_width="200dp"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="@string/your_text">
<requestFocus
    android:duplicateParentState="true"
    android:focusable="true"
    android:focusableInTouchMode="true" />
android:layout\u width=“200dp” android:layout\u height=“包装内容” android:duplicateParentState=“true” android:ellipsize=“marquee” android:fadingEdge=“水平” android:focusable=“true” android:focusableInTouchMode=“true” android:marqueeRepeatLimit=“永远选框” android:scroll=“true” android:singleLine=“true” android:text=“@string/your_text”>
我知道它适合文本视图。我想为
微调器
执行此操作。