Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:16:09+00:00 2026-06-16T17:16:09+00:00

I am trying to implement a text view which scrolls continuously. But the text

  • 0

I am trying to implement a text view which scrolls continuously.

But the text is not scrolling.
I want the text to be displayed in the following format:

enter image description here

This is the code that I have written.

public class ScrollingTextView extends TextView {
    public ScrollingTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public ScrollingTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ScrollingTextView(Context context) {
        super(context);
    }

    @Override
    protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
        if(focused)
            super.onFocusChanged(focused, direction, previouslyFocusedRect);
    }

    @Override
    public void onWindowFocusChanged(boolean focused) {
        if(focused)
            super.onWindowFocusChanged(focused);
    }

    @Override
    public boolean isFocused() {
        return true;
    }
}

This is my xml code.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:background="@color/background"
        android:orientation="vertical" >

        <org.fluturasymphony.recommendation.ScrollingTextView
            android:id="@+id/TextView03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:padding="25dip"
            android:scrollHorizontally="true"
            android:singleLine="true"
            android:text="Really Long Scrolling Text Goes Here.... ..... ............ .... ...." />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="170dp"
            android:background="@color/background"
            android:orientation="horizontal" >

            <EditText
                android:id="@+id/outlet_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:hint="@string/outlet_id_text"
                android:inputType="textAutoComplete" />

            <ImageView
                android:id="@+id/search_button"
                android:layout_width="32dp"
                android:layout_height="32dp"
                android:adjustViewBounds="true"
                android:contentDescription="@string/cd_search_icon"
                android:src="@drawable/search_icon" />
        </LinearLayout>

        <Button
            android:id="@+id/view_stores_on_map"
            android:layout_width="221dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="76dp"
            android:onClick="showStoreList"
            android:text="@string/view_stores_on_map" />

        <Button
            android:id="@+id/view_stores"
            android:layout_width="221dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="38dp"
            android:onClick="showStoreList"
            android:text="View List Of Stores" />
    </LinearLayout>

</RelativeLayout>

Can anyone tell me how to implement this?
Again, what I need is for the code in the red box to scroll continuously.

public class HomeActivity extends Activity {    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.home);    

      final Button view_stores = (Button) findViewById(R.id.view_stores);
      final Button view_stores_on_map = (Button) findViewById(R.id.view_stores_on_map);
      final EditText outlet_id = (EditText) findViewById(R.id.outlet_id);
      final ImageView search_button = (ImageView) findViewById(R.id.search_button);

      view_stores.setOnClickListener(new Button.OnClickListener(){
         public void onClick(View v){
            // Load the stores
           Intent myIntent = new Intent(HomeActivity.this, StoreListActivity.class);            
           startActivity(myIntent);
           HomeActivity.this.startActivity(myIntent);
         }
      });
      TextView tv;

      tv = (TextView) findViewById(R.id.textId);----------->***text view***
      tv.setSelected(true);

      search_button.setClickable(true);
      search_button.setOnClickListener(new View.OnClickListener() {

      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        String outlet_no = outlet_id.getText().toString();
        if(!outlet_no.isEmpty()){
        SharedPreferences myPrefs = getApplicationContext().getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
        SharedPreferences.Editor prefsEditor = myPrefs.edit();

        prefsEditor.putString("outlet_id", outlet_no);
        prefsEditor.commit();

        Intent myIntent = new Intent(HomeActivity.this, StoreActivity.class);       
        startActivity(myIntent);
        HomeActivity.this.startActivity(myIntent);
        }
        else{
          Toast.makeText(getApplicationContext(), "Please enter an outlet id", Toast.LENGTH_SHORT);
        }  
      }
    });

    view_stores_on_map.setOnClickListener(new Button.OnClickListener(){

      @Override
      public void onClick(View v){
        SharedPreferences myPrefs = getApplicationContext().getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
        SharedPreferences.Editor prefsEditor = myPrefs.edit();

        prefsEditor.putString("show_all", "1");
        prefsEditor.commit();
        Intent myIntent = new Intent(HomeActivity.this, StoreMapActivity.class);       
        startActivity(myIntent);          
      }
    });
    }

    /*
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.settings_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.set_client:     final CharSequence[] items = {"colgate", "godrej", "parle"};
                                      AlertDialog.Builder builder = new AlertDialog.Builder(this);
                                      builder.setTitle("Set the client");
                                      builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int item) {
                                          SharedPreferences myPrefs = getApplicationContext().getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
                                          SharedPreferences.Editor prefsEditor = myPrefs.edit();

                                          prefsEditor.putString("client",(String) items[item]);
                                          prefsEditor.commit(); 
                                        }
                                       });
                                      AlertDialog alert = builder.create();
                                      alert.show();

                                      break;            
        }
        return true;
    }
    */   
}

This is my java code from where i am calling the text view is it the right way to call the text view?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:16:10+00:00Added an answer on June 16, 2026 at 5:16 pm

    Try this :

    <TextView
                android:id="@+id/textId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:ellipsize="marquee"
                android:fadingEdge="horizontal"
                android:lines="1"
                android:marqueeRepeatLimit="marquee_forever"
                android:scrollHorizontally="true"
                android:singleLine="true"
                android:text="Simple application that shows how to use marquee, with a long text"
                android:textColor="#ff4500" />
    

    From Activity do this :

        TextView tv;
    
        tv = (TextView) findViewById(R.id.textId);
        tv.setSelected(true);
    

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement custom view to display the text, but there is a
I'm trying to implement the following code, which run successfully, but blows right through
I'm trying to implemet a scrollable Text view (not editable) that display some help
I'm trying to implement a program similar to 20 Questions, in which a text
While trying to implement a scene where item sizes do not change but distances
This is the sample code for web services which am trying to implement .
Is this even possible? I want to select/mark text without text view becoming first
I am trying to implement list. Here is start.xml file which have a text
I am trying to implement remote validation by following tutorial from Here but it
I am trying to implement this MVVM pattern for the WPF form closing which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.