Android
Android

Reputation: 183

Marquee not working in spinner Android

In my app I have tried to use marquee functionality but its not working. I used it in a Spinner and I have also seen many examples that its working in it but In my case its not working. In XML page under Spinner tag I used,

android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"

And In java page I have used this,

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 don't have any problem its showing result but marquee not working on it.

Where I am wrong?

Plese help.

thanks.

Upvotes: 1

Views: 1085

Answers (1)

vadher jitendra
vadher jitendra

Reputation: 590

Try this one.. Put this line of code in your text view....

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" />

Upvotes: 2

Related Questions