2012-02-07 64 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

相关问题