android - ellipsize="marquee" doesn't work in spinner -
i using simple spinner:
final simplecursoradapter statusadapter = new simplecursoradapter(this, android.r.layout.simple_spinner_item, null, new string[] { "_id" }, new int[] { android.r.id.text1 }, 0); statusadapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); statusespinner.setadapter(statusadapter);
there android:ellipsize="marquee"
attribute in both android.r.layout.simple_spinner_item
, android.r.layout.simple_spinner_dropdown_item
. don't see marquee animation when text long.
as read in link, should phone call setselected(true)
in textview. extend custom adapeter , here bindview
method:
@override public void bindview(view view, context context, cursor cursor) { textview textview = (textview) view .findviewbyid(android.r.id.text1); textview.settext(cursor.getstring(0)); textview.setselected(true); }
but didn't solve problem. how can have marquee spinner?
thats true android.r.layout.simple_spinner_item contains android:ellipsize="marquee" here there other attributes need define in android xml below id code snip :
row.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context=".mainactivity" > <textview android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <textview android:id="@+id/text2" android:layout_width="match_parent" android:layout_height="wrap_content" android:singleline="true" android:ellipsize="marquee" android:marqueerepeatlimit ="marquee_forever" android:textstyle="bold"/> </linearlayout>
complete source code
android textview android-textview android-spinner marquee
No comments:
Post a Comment