2017-07-07 3 views
-1

I wouldlike 2 Textview in der gleichen Zeit blättern:Scrolling 2 Textview in der gleichen Zeit mit Android Studio

Code:

TextView text_A; 
TextView text_B; 

A=(TextView)findViewById(R.id.t1); 
B=(TextView)findViewById(R.id.t2); 

A.setMouvementMethod(new ScrollingMovementMethod()); 
B.setMouvementMethod(new ScrollingMovementMethod()); 

Wie kann ich diesen Code für Werke ändern?

Danke für Ihre Hilfe!

Antwort

1

Sie haben soeben Ihre alle Ansichten Text setzen in eine Linearlayout und setzen dann das Layout in das ScrollView.For Beispiel

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:scrollbars="horizontal" android:id="@+id/ScrollView"> 

<LinearLayout 
     android:layout_width="fill_parent"      
     android:orientation="vertical" 
     android:id="@+id/linearLayout1" 
     android:layout_height="fill_parent" 
     android:layout_gravity="center_vertical|center_horizontal"> 

    <TextView android:text="@string/textView1" 
     android:id="@+id/t1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
    </TextView> 

    <TextView android:text="@string/textView2" 
     android:id="@+id/t2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
    </TextView> 
</LinearLayout> 
</ScrollView> 

mit diesem Link finden Sie auch Try

+1

Dank! es ist perfekt ! – azzerty2017