0

我需要一些关于我在几周前使用在线源代码和一些小游戏创建的当代艺术画廊应用程序的帮助。一切正常,但现在我们正在向关于艺术家的页面添加更多艺术家,但出现了问题。当我添加更多文本时,它会聚在一起并尝试将其全部放入一个屏幕中。相关代码如下。我认为布局设置很简单,但似乎并非如此。

如果有人可以提供帮助,我将不胜感激。

谢谢,乔纳森

如果您需要下载它,可以在 Flaneur Art Gallery 下的 Google Play 上下载。

 <?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>    
4

3 回答 3

0

//尝试使用lines或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" />
于 2012-09-27T09:13:20.050 回答
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>

最后结束滚动视图标签

于 2012-09-27T09:13:56.820 回答
0

您可以将文本视图放在 aScrollView中,如下所示。这样,您将在屏幕上固定按钮和标题标签,并在其下方滚动“关于”文本视图,占据屏幕的其余部分。

<?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>    

您可能需要调整重量和宽度/高度以获得所需的精确视图。

于 2012-09-27T09:16:06.917 回答