2012-09-27 23 views
0

我需要一些當前藝術畫廊應用程序的幫助,這是我在幾個星期前從在線源代碼和一些jiggery-pokery創建的。這一切都行得通,但現在我們正在爲藝術家頁面添加更多藝術家,並且存在問題。當我添加更多的文本時,它會聚集起來,並嘗試將其全部放入一個屏幕中。相關代碼如下。我認爲這是佈局設置很簡單,但它似乎沒有。Android Eclipse - 如何讓頁面向下滾動並顯示更多文字

如果有人能幫助我,我會非常感激。

感謝, 喬納森

如果您需要下載它,它可以用谷歌下漫遊者美術館播放。

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



<Button 
android:id="@+id/buttonBack" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="Back"/> 


    <TextView 
     android:layout_width="316dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.03" 
     android:gravity="top|left" 

     android:text="About the artists:" 
     android:textSize="15dp" /> 




     <TextView 
     android:layout_width="316dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.03" 
     android:gravity="top|left" 

     android:text="RUTH SCOTT is painter who has finally been released from a desk job and can't wait to make the most of her abilities. \nARTISTX is a conceptual artist with an interest in food.\nMELANIE PHELAN creates bold and seductive pieces with a sense of strength, positivity and humour, based on the aesthetic ideal of women portrayed in mass media." 
     android:textSize="12dp" /> 
</LinearLayout>  
+0

add 你想要的地方 –

回答

0

//嘗試使用線或的maxlines並刪除LayoutWeight 使用android:maxEms="30"

<TextView 
     android:layout_width="316dp" 
     android:layout_height="wrap_content" 
     android:maxEms="30" 
     android:gravity="top|left" 
     android:lines="5" 

     android:text="RUTH SCOTT is painter who has finally been released from a desk job and can't wait to make the most of her abilities. \nARTISTX is a conceptual artist with an interest in food.\nMELANIE PHELAN creates bold and seductive pieces with a sense of strength, positivity and humour, based on the aesthetic ideal of women portrayed in mass media." 
     android:textSize="12dp" /> 
0

添加滾動視圖的線性佈局前:

<?xml version="1.0" encoding="utf-8"?> 
    <ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@+id/edittext1" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="5dp" 
    android:layout_marginTop="25dp" 
    android:background="@android:drawable/editbox_background_normal" > 


     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

<Button 
android:id="@+id/buttonBack" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="Back"/> 
<TextView 
    android:layout_width="316dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.03" 
    android:gravity="top|left" 
    android:text="About the artists:" 
    android:textSize="15dp" /> 

    <TextView 
    android:layout_width="316dp" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.03" 
    android:gravity="top|left" 

    android:text="RUTH SCOTT is painter who has finally been released from a desk job and can't wait to make the most of her abilities. \nARTISTX is a conceptual artist with an interest in food.\nMELANIE PHELAN creates bold and seductive pieces with a sense of strength, positivity and humour, based on the aesthetic ideal of women portrayed in mass media." 
    android:textSize="12dp" /> 
    </LinearLayout>  
</ScrollView> 

,並在最後結束滾動視圖標籤

0

你可以將你的文本視圖放在裏面一個ScrollView,像下面的東西。通過這種方式,您將在屏幕上固定按鈕和標題標籤,並在其下方滾動「約」文本視圖,佔據屏幕的其餘部分。

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

    <Button 
    android:id="@+id/buttonBack" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Back"/> 

    <TextView 
     android:layout_width="316dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.03" 
     android:gravity="top|left" 

     android:text="About the artists:" 
     android:textSize="15dp" /> 


     <ScrollView 
     android:layout_width="316dp" 
     android:layout_height="fill_parent"> 

      <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="top|left" 

      android:text="RUTH SCOTT is painter who has finally been released from a desk job and can't wait to make the most of her abilities. \nARTISTX is a conceptual artist with an interest in food.\nMELANIE PHELAN creates bold and seductive pieces with a sense of strength, positivity and humour, based on the aesthetic ideal of women portrayed in mass media." 
      android:textSize="12dp" /> 

    </ScrollView> 

</LinearLayout>  

您可能需要調整重量和寬度/高度以獲得所需的確切視圖。

+0

感謝所有回答的人。這一個伎倆。我會投票,如果我能看到點擊什麼! –

+0

@JonPowell在答案的左邊你可以看到一個灰色的複選標記。點擊它 - 它會變綠 - 你已經接受了答案。 –

相關問題