簡體   English   中英

如何在兩個文本視圖之間添加滾動視圖

[英]How add scrollview between two textviews

我的代碼如下所示:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/title"
        android:contentDescription="@string/title_name" />
    <TextView 
        android:id="@+id/space"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

    <ScrollView android:id="@+id/scroll_view1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:orientation="vertical">

     ---------
     ---------
</LinearLayout>

    </ScrollView>

    <TextView 
        android:id="@+id/space10"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

    <TextView 
        android:id="@+id/copyright"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/copyright_text"
        android:textColor="#ffffff"/>

</LinearLayout>

在這里,我可以在滾動視圖之前看到上面的textview和imageview,但是在scrollview之后看不到底部的textview。 我的代碼有什么錯誤嗎? 請幫幫我。

嘗試這個

<ImageView
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/title"
    android:contentDescription="@string/title_name" />
<TextView 
    android:id="@+id/space"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
   />

<ScrollView android:id="@+id/scroll_view1"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1.0">

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:orientation="vertical">

     ---------
     ---------
</LinearLayout>

</ScrollView>

<TextView 
    android:id="@+id/space10"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

<TextView 
    android:id="@+id/copyright"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/copyright_text"
    android:textColor="#ffffff"/>

希望能幫助到你...!!!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM