Android 如何增加列表视图的视图大小?

Android 如何增加列表视图的视图大小?,android,listview,Android,Listview,下面是我使用的xml代码 但即使尝试增加最小高度也没有用 请帮忙 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- He

下面是我使用的xml代码

但即使尝试增加最小高度也没有用

请帮忙

  <?xml version="1.0" encoding="utf-8"?>
<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <!-- Here you put the rest of your current view-->

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

  >
    <TextView  
    android:text="ID:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />   

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

   <TextView  
    android:text="Name:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

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

   <TextView  
    android:text="Posted By:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

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

   <TextView  
    android:text="Posted Time:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

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


    <TextView  
    android:text="Annotation ID:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />   

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

   <TextView  
    android:text="Comment:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

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


   <TextView  
    android:text="Image-path:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

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

   <TextView  
    android:text="Solutions:"
    android:textSize="15dp"
    android:textStyle="bold"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
   />

    <ListView
           android:id="@+id/listviewid"
           android:layout_marginBottom="10dp"
           android:paddingBottom="10dp"
           android:minHeight="1000dp"
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent" 
           />
</LinearLayout>
</ScrollView>

与之相关的java代码是:

if(s8.length()!=0){
                String[] sidarray = s8.split("@");
                String[] replyarray = s9.split("@");
                String[] replybyarray = s10.split("@");

                for(int p=0;p<sidarray.length;p++)
                {
                    if(solutionsList!=null){
                    solutionsList.add("\nSolutionsID:" + sidarray[p] );
                    solutionsList.add("\nReply:" + replyarray[p]);
                    solutionsList.add("\nReply-by:" + replybyarray[p]);
                }}
                solutionlist=(ListView)findViewById(R.id.listviewid);
                solutionadapter = new ArrayAdapter<String>(this, R.layout.solutiondisplay, solutionsList);
                solutionlist.setAdapter(solutionadapter);
             }
if(s8.length()!=0){
字符串[]sidarray=s8.split(“@”);
字符串[]replyarray=s9.split(“@”);
字符串[]replybyarray=s10.split(“@”);

对于(int p=0;p您是否尝试删除这些行?:

android:layout_marginBottom="10dp"
android:paddingBottom="10dp"

如果包含整个布局xml,则会有所帮助


您是否尝试过将布局权重设置为1?

在我看来,您根本没有足够的空间。原因在于您选择了一些绑定到屏幕限制的布局(LinearLayout、RelativeLayout…)。一个屏幕上有许多内容。为了避免此问题,请使用ScrollView作为根,然后使用LinearLayout,然后可以在此LinearLayout中放置许多布局元素(跨多个屏幕长度).

您必须将scrollview的高度设置为
wrap\u content
我不确定在scrollview中包含ListView是否是一个好主意


您最好使用ListView将所有“问题”数据集成到解决方案集顶部的固定视图中。

当ListView在滚动视图中使用时,ListView只显示一个项目。因此您需要在java代码中调整ListView高度。
使用LayoutParams属性设置listview的高度和宽度。

是listview父级的布局高度还是“填充父级”是的,它的父级布局的高度也是填充的父级是的,我已经通过添加和删除尝试了xml中所有可能的事情。好的,你的布局xml的其余部分是什么样子的?你是对的。我已经监督过了。为什么你用15dp来表示字体大小而不是15sp?我不知道。“dp”和“sp”之间有什么区别?sp(与比例无关的像素)类似于dp,但建议在定义字体大小时使用sp,因为它也(除了屏幕密度)考虑到用户字体大小首选项。是否尝试更改此选项?好的,那么这看起来确实是源代码中的问题。如何填写列表?是否扩展ArrayAdapter。如果是,在函数getView()中膨胀哪个.xml?