2013-05-28 182 views
0

如何在應用程序中製作一個texview的平滑滾動條?這是一個類似於我的main.xml的示例:平滑滾動texview

<?xml version="1.0" encoding="utf-8"?> 
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<TextView 
    android:id="@+id/textView5" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:layout_marginTop="10dp" 
    android:text="ANDROID APPLICATION INFO" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:textColor="#FF8000" 
    tools:ignore="HardcodedText" /> 

<RadioButton 
    android:id="@+id/radio_english" 
    android:layout_width="201dp" 
    android:layout_height="55dp" 
    android:onClick="onRadioButtonClicked" 
    android:text="English" 
    tools:ignore="HardcodedText" /> 

<RadioButton 
    android:id="@+id/radio_it" 
    android:layout_width="200dp" 
    android:layout_height="55dp" 
    android:onClick="onRadioButtonClicked" 
    android:text="Ita" 
    tools:ignore="HardcodedText" /> 

<TextView 
    android:id="@+id/AndroidInfo" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Android Info.:" 
    tools:ignore="HardcodedText" /> 

<TextView 
    android:id="@+id/Ainfo" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    tools:ignore="SelectableText" 
    android:text="blablablablabla blablablabla blablablablabla blablablabla `blablablablabla blablablabla blablablablabla blablablabla blablablablabla blablablabla" />` 

</RadioGroup> 

Ainfo textview是我想要滾動的。但順利滾動。我嘗試了不同的方式,但我試過的一切都是不平滑的滾動。任何提示,以迪呢?不要以功能上的考慮因爲是一個例子。只是想了解如何使滾動平滑。謝謝。

+0

你想使一個勞斯萊斯的文字?那會自動滾動? –

+0

我想要一個「正常」的平滑向下/向上滾動。就像每個使用滾動的應用程序。我不知道你的意思是「自動滾動」。但我認爲是相同的ahaha。我想當我用手指滾動textvew(是的,這是相同的,我想)自動滾動5/6/7行或1/2秒(我不知道它是如何工作的) –

回答

2

你想要這樣的東西嗎?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
tools:context=".MainActivity$DummySectionFragment" xmlns:app="http://schemas.android.com/apk/res/com.threesixtydgreen"> 

<ScrollView 
    android:id="@+id/horizontalScrollView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:scrollbars="none" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="blablablablabla blablablabla blablablablabla blablablabla `blablablablabla blablablabla blablablablabla blablablabla blablablablabla blablablabla" 
      android:textAppearance="?android:attr/textAppearanceLarge" /> 


</ScrollView> 

+0

mmh考慮我想垂直scrollview的textview ..是一樣的嗎?只需要用更改''? –

+0

是的。這就是你需要的。請標記這個答案是正確的,如果它幫助:) –

+0

現在我在工作,後來我會嘗試;)但是,謝謝我現在馬克! ;) –