2017-07-03 49 views
0

我有TextView的不匹配滾動型的一個問題...的TextView不適合滾動型

這裏是我的代碼:

<ScrollView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:id="@+id/scrollViewSlide" 
      tools:ignore="UselessParent"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center"> 

       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_margin="10dp" 
        android:layout_gravity="center_vertical|center_horizontal" 
        android:id="@+id/txtPassage" 
        android:textAlignment="center" 
        android:textIsSelectable="true" 
        android:textColor="#ffffff" 
        android:textSize="15sp" 
        tools:ignore="UnusedAttribute" /> 

      </LinearLayout> 

     </ScrollView> 

s.th顯示和是假的(更好這樣,大約5第一行是隱藏的)enter image description here

+1

不清楚是什麼你問... –

+0

這是一種很難解釋,我的意思是滾動型切割的TextView,例如TextView的有10條線,但它顯示7行! –

回答

0

試試這個

<ScrollView 
    android:layout_width="match_parent" 
    android:fillViewport="true" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/li1" 
     android:orientation="vertical"> 

     <TextView 
      android:layout_width="match_parent" 
      android:text="Hellofgbjfdkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkhbhbghbuuuuuuuuuuuuuuuubfiiiiiiiiiibigyygfjjjjjjjjjjjjjjjjjjjjjjjjjj\nfjgggggggggggggggg\ngfggggggggggggggggggg\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\njgjijhijghijgfhjgfhjigfjhijgfhjgi 
      jfdjgkfjd\nkkgkfgklfkgfg" 
      android:layout_height="match_parent" /> 
    </LinearLayout> 

</ScrollView> 
+0

感謝的人,它解決了我的問題 –

+0

@hassanmoradnezhad最受歡迎 –

0

使用此代碼說,這將有助於

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/li1" 
     android:orientation="vertical"> 

     <TextView 
      android:layout_width="match_parent" 
      android:text="Hello" 
      android:layout_height="match_parent" /> 
    </LinearLayout> 

</ScrollView>