Is scrolling a textview impossible?

前端 未结 2 1851
一向
一向 2021-01-29 05:09

I make a mini adventure game for Android to learn Android programming. But my textview which contains information about the game events does not scroll. I have done it programma

2条回答
  •  无人共我
    2021-01-29 06:00

    Layout

    
    
        
    
        />
    
        

    Java

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fullscreen);
       // vScroll = (ScrollView) findViewById(R.id.vScroll);
    
        scrollable = (TextView)findViewById(R.id.textView1);
    
        //Enabling scrolling on TextView.
        scrollable.setMovementMethod(new ScrollingMovementMethod());
    for(int i=0;i<100;i++)
        scrollable.append("q");
    
       // TableRow tr3=(TableRow)findViewById(R.id.tableRow3);
      //View v = findViewById(R.id.view);
        //ag = new AdventureGame((TableLayout)findViewById(R.id.tableLayout1), scrollable, this, 5, "Jamie", onScoreListener);
      // ag.setBackground(getResources().getDrawable(R.mipmap.dungeon));
      //  tr3.addView(ag);
    
       // new Adventure(scrollable, this, ag);
       // v = ag;
    
        AdventureGame ag = findViewById(R.id.view);
        ag.text = findViewById(R.id.textView1);
        ag = findViewById(R.id.view);
    
        new Adventure(scrollable, this, ag);
    
    }
    

    And it scrolls!

提交回复
热议问题