在我的应用程序中,我尝试使用选取框功能,但它不起作用。我在 Spinner 中使用了它,我也看到了很多它在其中工作的例子,但在我的例子中它不起作用。在我使用的 Spinner
标签下的 XML 页面中,
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) {
}
});
}
Spinner 的显示结果没有任何问题,但 marquee 无法正常工作。
我哪里错了?
请帮忙。
谢谢。
最佳答案
试试这个.. 将这行代码放在您的 TextView 中....
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 - Marquee 在微调器 Android 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21406656/