2012-03-15 4 views
0

У меня есть список, который находится в табло. Данные отображаются, но я хочу, чтобы listview был «выше» (больше высоты), но я не могу понять, как это сделать. Я установил высоту в xml для всего (300dp, 500dp, wrap_content), но, похоже, ничего не происходит. Вот мой XML:Android-set listview height

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="#98c4ed"> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:id="@+id/tableLayout" 
     android:layout_height="wrap_content" 
     android:shrinkColumns="1" 
     android:layout_margin="5dp"> 
     <TableRow android:id="@+id/trSubStatus" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 
      <TextView 
       android:id="@+id/tvSubStatusLabel" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Sub-Status:" 
       style="@style/IssueDetailsLabelTextView" /> 
      <TextView 
       android:id="@+id/tvSubStatus" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       style="@style/IssueDetailsTextView" /> 
     </TableRow> 
     <TableRow android:id="@+id/trDescription" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" > 
      <TextView 
       android:id="@+id/tvDescriptionLabel" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Description:" 
       style="@style/IssueDetailsLabelTextView" /> 
      <TextView 
       android:id="@+id/tvDescription" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       style="@style/IssueDetailsTextView" /> 
     </TableRow> 
     <TableRow android:id="@+id/trActivities" 
      android:layout_width="match_parent" 
      android:layout_height="500dp" 
      android:layout_marginTop="10dp"> 
      <TextView 
       android:id="@+id/tvActivitiesLabel" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="Issue Activities:" 
       style="@style/IssueDetailsLabelTextView" /> 
      <ListView 
       android:id="@+id/lvActivities" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"     
       android:background="#ffffff" 
       android:cacheColorHint="#00000000"> 
      </ListView> 
     </TableRow> 
     <TableRow android:id="@+id/trLast" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="20dp"> 
     </TableRow> 
    </TableLayout> 
</LinearLayout> 

прямо сейчас, ListView заселяется, но его высота меняется, и я должен прокручивать в ListView, чтобы увидеть больше. EDIT: Извините, это означает, что это lvActivities в строке trActivities, с которой у меня возникают проблемы.

Редактировать: Я бы хотел, чтобы ListView был размером xx в высоте. Listview - последний элемент управления в макете, поэтому, если данные, помещенные в элементы управления над ним, сделают макет выше страницы, я бы хотел, чтобы страница прокрутила, чтобы увидеть lvActivities. Прямо сейчас, LlvActivities сокращается или расширяется до размера страницы, и это боль, чтобы прокручивать lvActivities, когда она только 1/2 дюйма (сигнализация данных в других элементах управления).

+0

Try 'андроида: layout_height = "match_parent"' в ListView, а также. – Rajkiran

+0

Я пробовал это, и он делает ряд экстремально маленьким ... – Robert

+1

Хорошо. Затем попробуйте 'android: weightSum' в строке и' android: weight' в listview. Например, если ваш весит равен 7, тогда поместите вес = 5 в список. Также убедитесь, что высота вашей строки достаточно велика. Если нет, примените «android: weightSum» к своему родительскому элементу. – Rajkiran

ответ

0

Почему вы не используете android:minHeight, android:minWidth, android:maxHeight, android:maxWidth ??

+0

Я использовал minHeight: 500dp, и это только сделало его немного больше. даже когда я использую 5000dp, нет никаких изменений с 500dp. Кроме того, у меня нет свойства maxHeight или maxWidth. Использование ASUS EEE Tablet on Ice Cream 4.0.3 – Robert

+0

Если вы попытаетесь изменить 'android: layout_height =" 500dp "', определенные в родительском элементе TableRow ListView для wrap_content? или это не то, что вам нужно? – youchy

+0

Я тоже пробовал, посмотрю мой последний комментарий выше ... – Robert

0

Попробуйте ->

list.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, theSizeIWant)); 

;