我有一个ScrollView包含了一个ViewFlipper。ViewFlipper中的内容高度不均,因此我的第二个屏幕有一个非常长的滚动条,并且还有很多空白内容:
<ScrollView android:id="@+id/outer_scroll"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:fillViewport="true">
<ViewFlipper android:id="@+id/flipper"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<EditText android:id="@+id/desc" style="@style/DescriptionArea"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:enabled="false" android:focusableInTouchMode="false"
android:background="@null" />
<LinearLayout android:id="@+id/details_root"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="10dp">
<TextView android:id="@+id/item_details" style="@style/DetailsLarge"
android:textColor="#000" android:visibility="gone"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:text="@string/item_details_tags" />
<TextView android:id="@+id/tags" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:textColor="#000"
android:visibility="gone" />
</LinearLayout>
</ViewFlipper>
</ScrollView>
因此,例如,EditText块非常长,滚动条捕获了全部内容。我向LinearLayout滑动,滚动条继续超过TextView的内容。我需要“重新计算”视图高度。
另外,将EditText和LinearLayout包装在它们自己的ScrollViews中不是一个选项,因为软/虚拟键盘会阻挡EditText的内容。