2012-04-12 26 views
0
页面

其它元素我有,我显示评论列表,然后显示一个文本区域,为人们增添更多评论活动滚动。Android的 - 列表而不

现在是否有到达屏幕底部的一些评论,这是过度写的文本区域。

我宁愿是如果整个页面滚动与评论和文本区域在一起。

这是我目前的布局XML:

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

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

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

<TextView 
    android:id="@+id/question_label"  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Your question: " 
    />  

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

<TextView 
    android:id="@+id/please_wait"  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Please wait while the discussion loads..." 
    />  

    <ListView 
    android:id="@android:id/list" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@+id/label" 
     android:textSize="20px" >   
    </ListView> 

     <EditText 
      android:id="@+id/question_text" 
      android:layout_height="wrap_content" 
      android:hint="@string/question_comment_hint" 
      android:inputType="textMultiLine" 
      android:lines="5" 
      android:layout_width="fill_parent"> 
     </EditText> 

<Button 
      android:id="@+id/submit" 
      android:layout_height="wrap_content" 
      android:text="@string/submit" 
      android:onClick="sendFeedback" 
      android:layout_width="fill_parent"> 
     </Button>    

    </LinearLayout> 
</ScrollView> 

</LinearLayout> 

谢谢!

+1

如果我每次都发表评论,一路滚动到下我会一个沮丧的用户:)。你为什么不把你的edittext和button放到scrollview之外,这样用户可以在查看列表的同时在任何时候添加评论? – Jack 2012-04-12 13:37:08

+1

你不应该在滚动视图中有一个listview。 – dmon 2012-04-12 13:39:10

+0

同意@Jack。我认为你应该有一个菜单选项或操作栏选项(取决于你正在构建的Android的版本),这是一个“新评论”选项,将为您提供一个对话框,允许您输入新评论 – dymmeh 2012-04-12 13:39:47

回答

1

使用页脚在您的列表视图(view.setFooterView())。这是解释here

,并在同一时间不要同时使用ListView和滚动视图。这里Listview完全够用了。