Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在滚动视图中逐渐显示图像?_Android_Xml_Android Imageview_Android Scrollview - Fatal编程技术网

Android 如何在滚动视图中逐渐显示图像?

Android 如何在滚动视图中逐渐显示图像?,android,xml,android-imageview,android-scrollview,Android,Xml,Android Imageview,Android Scrollview,是否有任何过程可以在运行时逐渐增加ScrollView的高度。我的目的是逐渐显示ScrollView中的图像。因此我想增加ScrollView的高度。有没有办法完成我的工作??请帮助我。我的XML文件的内容是: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rootLayout" android:layout_width="f

是否有任何过程可以在运行时逐渐增加ScrollView的高度。我的目的是逐渐显示ScrollView中的图像。因此我想增加ScrollView的高度。有没有办法完成我的工作??请帮助我。我的XML文件的内容是:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rootLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="80dp"
        android:scrollbars="none"
        android:layout_x="0dp"
        android:layout_y="0dp"
        android:fillViewport="true" >

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="0dp"
        android:layout_y="0dp"
        android:src="@drawable/background" />
        </LinearLayout>

    </ScrollView>

    </LinearLayout>
这是我的屏幕截图:


模糊图像在Scrollview中显示,随着Scrollview高度的增加,模糊图像逐渐显示。

我已编辑了您的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="80dp">

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width=" fill_parent"
        android:layout_height="wrap_content" >


<ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:src="@drawable/background" />
    </LinearLayout>

</ScrollView>


让我知道你到底做了没有。。好的。

您可以使用以编程方式设置宽度和高度。查看mao提出的问题和解决方案。

r您通过编程在图像上添加了多个图像??不。只有一个图像已经在scrollView中。请向我明确您要显示的内容。如果只有一个图像比为什么在scrollView中添加多个图像??请在代码中使用编程设置宽度和高度。嗯。。。。!!!只有一个图像。我的目的是逐渐增加scrollView的高度,以便可以显示其中包含的图像。。等等,我在这里发布一些屏幕截图。。!!!滚动视图的高度不会固定。它将定期增加。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rootLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="80dp">

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width=" fill_parent"
        android:layout_height="wrap_content" >


<ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:src="@drawable/background" />
    </LinearLayout>

</ScrollView>