ScrollView, встроенный в TableLayout, встроенный в RelativeLayout, с ListView за пределами не работающего - PullRequest
0 голосов
/ 29 июля 2010

До того, как я добавил свой ListView, наряду с изменением высоты TableLayout на «wrap_content», а не на «fill_parent», мой ScrollView отображался правильно.Вот мой XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" >
 <TableLayout android:id="@+id/details"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_alignParentBottom="true"
  android:stretchColumns="1">
  <TableRow>
   <TextView android:text="Restaurant Name: " />
   <EditText android:id="@+id/name" />
  </TableRow>
  <TableRow>
   <TextView android:text="Address: " />
   <EditText android:id="@+id/addr" />
  </TableRow>
  <TableRow>
   <TextView android:text="Type:" />
   <ScrollView
    android:layout_height="wrap_content"
    android:layout_width="fill_parent">
   <RadioGroup android:id="@+id/types"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:orientation="vertical">
    <RadioButton android:id="@+id/fastfood"
     android:text="Fast-Food" />
    <RadioButton android:id="@+id/family"
     android:text="Family" />
    <RadioButton android:id="@+id/casual_dining"
     android:text="Casual Dining" />
    <RadioButton android:id="@+id/fine_dining"
     android:text="Fine Dining" />
    <RadioButton android:id="@+id/cafe"
     android:text="Cafe" />
    <RadioButton android:id="@+id/cafeteria"
     android:text="Cafeteria" />
    <RadioButton android:id="@+id/coffeehouse"
     android:text="Coffeehouse" />
    <RadioButton android:id="@+id/pub"
     android:text="Pub" />
    <RadioButton android:id="@+id/greasy_spoon"
     android:text="Greasy Spoon" />
    <RadioButton android:id="@+id/chain"
     android:text="Chain" />
    <RadioButton android:id="@+id/truck_stop"
     android:text="Truck Stop" />
    <RadioButton android:id="@+id/smorgasbord"
     android:text="Smorgasbord" />
   </RadioGroup>
   </ScrollView>
  </TableRow>
  <TableRow>
   <TextView android:text="" />
   <Button android:id="@+id/save"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Save" />
  </TableRow>
 </TableLayout>
 <ListView android:id="@+id/restaurants"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_alignParentTop="true"
  android:layout_above="@id/details" />
</RelativeLayout>

Я не получаю ScrollView, когда у меня есть "wrap_content", и мой дисплей косо!Есть идеи?

1 Ответ

0 голосов
/ 29 июля 2010

Я действительно экспериментировал с разными значениями высоты.Когда я указываю конкретную высоту, общее отображение так и должно быть.Я просто добавил определенное значение к моей высоте TableLayout и моей высоте ScrollView, и все в порядке.

Я не уверен, почему это так, но это работает.Если кто-то хочет объяснить логику ... не стесняйтесь!:)

...