我有一个 Android 布局。我已经设置了一个像list.setOnItemClickListener
. 一切似乎都很好。
在下面的行中:
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content">
如果我android:layout_height
从更改wrap_content
为fill_parent
它不再起作用(无法选择我列表中的项目)。
只有设置为wrap_content
. 为什么会这样?
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ListView android:id="@+id/restaurants"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:shrinkColumns="1"
android:paddingTop="4dip"
>
<TableRow>
<TextView android:text="@string/name" />
<EditText android:id="@+id/name" />
</TableRow>
<TableRow>
<TextView android:text="@string/address" />
<EditText android:id="@+id/addr" />
</TableRow>
<TableRow>
<TextView android:text="Type:" />
<RadioGroup android:id="@+id/types">
<RadioButton android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/take_out"
android:text="@string/takeout"
android:checked="true"
/>
<RadioButton android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/sit_down"
android:text="@string/sitdown"
/>
<RadioButton android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/delivery"
android:text="@string/delivery"
/>
</RadioGroup>
</TableRow>
<TableRow>
<TextView android:text="@string/notes" />
<EditText android:id="@+id/notes" />
</TableRow>
<Button android:id="@+id/save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/save"
/>
</TableLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>
</TabHost>