Tôi có một ScrolLView kết thúc tốt đẹp một ViewFlipper. Các nội dung trong ViewFlipper không có chiều cao bình đẳng, vì vậy màn hình thứ hai của tôi có một thanh cuộn rất lâu đến nỗi đi và về với nội dung trống:Tính toán lại ScrollView trên các chế độ xem ViewFlipper khác nhau?
<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>
Vì vậy, ví dụ, khối EditText là rất dài, và thanh cuộn sẽ chụp tất cả. Tôi chạy đến LinearLayout và thanh cuộn tiếp tục qua nội dung TextView. Tôi về cơ bản cần nó để "tính toán lại" chiều cao xem.
Ngoài ra, việc gói EditText và LinearLayout trong ScrollViews của riêng nó không phải là một tùy chọn, vì sau đó bàn phím mềm/ảo chặn nội dung EditText.
Ồ, tôi vừa hỏi một phút câu hỏi tương tự sau khi bạn ... http://stackoverflow.com/questions/3570362/getting-rid-of-extra-space-in-text-switcher – ekawas