首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ViewFlipper高度问题

ViewFlipper高度问题
EN

Stack Overflow用户
提问于 2012-08-20 16:31:55
回答 3查看 1.8K关注 0票数 3

在下面的代码中,viewflipper并没有占据整个屏幕,它只是围绕着textview。为什么会发生这种情况?

代码语言:javascript
复制
<?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>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-08-21 02:59:41

在scrollView中使用

android:fillViewport="true"

票数 4
EN

Stack Overflow用户

发布于 2012-08-20 17:32:02

代码语言:javascript
复制
<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>

这将会起作用。

票数 0
EN

Stack Overflow用户

发布于 2012-08-20 18:32:00

为什么要增加View Flippers的高度?视图翻转取决于您在it..So中添加的内容或视图,视图翻转的高度和宽度将始终等于您提供给视图的最大高度/宽度。因此,如果您增加当前视图的高度,或者添加另一个高度大于当前一个视图的textView,那么翻转将会增加。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12034467

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档