在下面的代码中,viewflipper并没有占据整个屏幕,它只是围绕着textview。为什么会发生这种情况?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000ff" >
<ViewFlipper android:id="@+id/ViewFlipper01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa0000"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"></TextView>
</ViewFlipper>
</ScrollView>
</LinearLayout>发布于 2012-08-21 02:59:41
在scrollView中使用
android:fillViewport="true"
发布于 2012-08-20 17:32:02
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000ff" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ViewFlipper android:id="@+id/ViewFlipper01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#aa0000"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp">
</TextView>
</ViewFlipper>
</LinearLayout>
</ScrollView>这将会起作用。
发布于 2012-08-20 18:32:00
为什么要增加View Flippers的高度?视图翻转取决于您在it..So中添加的内容或视图,视图翻转的高度和宽度将始终等于您提供给视图的最大高度/宽度。因此,如果您增加当前视图的高度,或者添加另一个高度大于当前一个视图的textView,那么翻转将会增加。
https://stackoverflow.com/questions/12034467
复制相似问题