2012-02-07 62 views
0
<?xml version="1.0" encoding="utf-8"?> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="EN LEZİZ KISIR TARİFİ BURADA" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/kisir" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/malzemeler" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hazirlanisi" /> 


    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:fillViewport="true" > 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:singleLine="false" 
      android:text="@string/secenek" /> 

    </ScrollView> 

    </LinearLayout> 

當我點擊按鈕,我希望能夠使用scrollView能夠讀取文本的其餘部分,我保持字符串值的文本很長,但我couldn'創建scrollView。我在哪裏做錯了?謝謝。爲什麼scrollView不能使用textView?我試圖在Android 2.2模擬器上

+0

是在屏幕底部的textview還是在屏幕底部可用的任何空間? – 2012-02-07 11:14:25

+0

如果文字較多,無法放入可用的屏幕區域,則滾動條會出現滾動。它爲我工作。你能看到至少部分文字或全文嗎? – 2012-02-07 11:24:38

+0

是的,它是可用的。 – 2012-02-07 11:35:59

回答

0

您不能在textview內使用scrollview。您可以使用滾動視圖而不是線性佈局。你在錯誤的地方使用scrollview。

+0

問題是不是emulator.you不能使用佈局裏面的scrollview – 2012-02-07 12:02:57

+0

不,我可以使用滾動查看裏面的佈局。嘗試上面的佈局。它正在工作。 – 2012-02-07 17:25:28

0
<ScrollView 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" > 

<LinearLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:gravity="center" 
android:orientation="vertical" > 

<TextView 
android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="vertical" 
      android:singleLine="false" 
      android:text="Your Text" /> 
    </LinearLayout> 

</ScrollView> 
+0

予製成爲你說:我也移動了滾動視圖,但它強制關閉模擬器。 – 2012-02-07 11:29:35

+0

我已經更新了我的答案,使您更容易。將其插入您希望文本可以滾動的位置。 – Yuvi 2012-02-08 05:21:41

相關問題