Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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 当儿童身高增加时,ScrollView不会滚动_Android_Android Layout_Android Linearlayout_Android Scrollview - Fatal编程技术网

Android 当儿童身高增加时,ScrollView不会滚动

Android 当儿童身高增加时,ScrollView不会滚动,android,android-layout,android-linearlayout,android-scrollview,Android,Android Layout,Android Linearlayout,Android Scrollview,我有一个滚动视图,其中包含2个片段。底部片段有2个EditText视图。当我在任一编辑文本中输入多行文本时,屏幕上视图的总体高度要求自然会增加。但是,屏幕会切断由于多行文本输入而被按下的任何内容。ScrollView不会在该点滚动 我已经尝试了一些建议的方法,比如不将ScrollView设置为根视图,或者添加一个空视图作为ScrollView的最后一个孙子,但到目前为止,这些方法都不起作用。这是我的XML: <LinearLayout xmlns:android="http://s

我有一个
滚动视图
,其中包含2个片段。底部片段有2个
EditText
视图。当我在任一编辑文本中输入多行文本时,屏幕上视图的总体高度要求自然会增加。但是,屏幕会切断由于多行文本输入而被按下的任何内容。ScrollView不会在该点滚动

我已经尝试了一些建议的方法,比如不将ScrollView设置为根视图,或者添加一个空视图作为ScrollView的最后一个孙子,但到目前为止,这些方法都不起作用。这是我的XML:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ScrollView
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        xmlns:android="http://schemas.android.com/apk/res/android">

        <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            tools:context=".MainActivity">

            <fragment
                android:id="@+id/fragment1"
                android:name="com.example.omar.memegenerator.TopImageFragment"
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="18dp"
                android:layout_marginBottom="18dp"
                tools:layout="@layout/fragment_top_image" />

            <fragment
                android:id="@+id/fragment2"
                android:name="com.example.omar.memegenerator.BottomControlsFragment"
                android:layout_width="match_parent"
                android:layout_height="134dp"
                android:layout_below="@+id/fragment1"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="34dp"
                tools:layout="@layout/fragment_bottom_controls" />

        </RelativeLayout>
    </ScrollView>

</LinearLayout>

将其用于布局层次结构。我省略了一些属性,但其中包含的属性是使其正常工作的关键

<ScrollView
    android:layout_height="match_parent"
    android:layout_width="match_parent">

    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:orientation="vertical">

        <fragment
            android:id="@+id/fragment1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <fragment
            android:id="@+id/fragment2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

   </LinearLayout>

</ScrollView>


滚动视图
根布局吗?是。它有一个固定的高度是很重要的,它起作用了。非常感谢你。我投了赞成票,接受了你的回答。如果你认为这是一个被问得很好的问题,你也能投票给我吗?嗨。如果可以,你能看看这个问题吗?我在这方面遇到了很多问题: