2010-10-01 21 views
5

Este es el código XML que solía¿Cómo puedo aumentar el tamaño de vista de mi vista de lista?

pero sin uso, aun cuando intente aumentar el MinHeight ....

favor ayuda

alt text

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

El código java relacionado con él es:

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); 
      } 

Here is my source code.................

+0

¿El layout_height del padre listView también es "fill_parent"? – pjz

+0

sí el layout_height de su padre también es fill_parent –

Respuesta

0

Ha intentado eliminar estas líneas ?:

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

sí, he intentado todas las cosas posibles en xml agregando y quitando –

+0

OK. Bueno, ¿cómo se ve el resto de tu diseño xml? – James

0

Sería de gran ayuda si se incluye todo el diseño XML.

¿Has intentado con el diseño de peso = 1?

+0

intenté pero no sirvió ... gracias de todos modos –

1

Me parece que simplemente no tiene suficiente espacio. La razón radica en el hecho de que seleccionó un diseño que está ligado a límites de pantalla (LinearLayout, RelativeLayout ...). Tienes muchas cosas en una pantalla. Para evitar este problema, utilice ScrollView como raíz, luego LinearLayout, y luego puede poner muchos elementos de diseño en este LinearLayout (abarcar varias pantallas de longitud).

+0

ya está incrustado todo el código xml dentro de la vista de desplazamiento –

+0

Tiene razón. Yo he supervisado eso. ¿Por qué está usando 15dp para el tamaño de fuente en lugar de 15sp? – Zelimir

+0

no lo sé. ¿Cuál es la diferencia entre "dp" y "sp"? –

0

usted tiene que fijar la altura de la ScrollView a wrap_content

+0

no, yo no ..... –

0

No estoy seguro de que incluye un ListView dentro de un ScrollView es una buena idea.

Será mejor que use ListView's header views feature para integrar todos sus datos de "Problema" en vistas fijas sobre el conjunto de soluciones.

0

Cuando se usa ListView dentro de scrollview en rutime, la vista de lista se apaga para mostrar solo un elemento. Por lo tanto, necesita ajustar la altura de la vista de lista en su código java. utiliza la propiedad LayoutParams para establecer el alto y el ancho para listview.

Cuestiones relacionadas