Android全屏,EditText向上推其他视图

Android全屏,EditText向上推其他视图,android,android-layout,Android,Android Layout,我正在开发一个应用程序,遇到了一个问题 我有一个视图,如下图所示,在正确的位置有一个图像和一个edittext字段。但当我点击edittext字段,它得到焦点时,它会向上推另一个视图 我有全屏标志,如果我不使用它,它工作得很完美,图像保持其位置,不会向上推。我需要有全屏标志的 有没有人能举个例子或者帮助我。我已将“WindowsOfInputMode”与所有posibles值一起使用 这里是我的布局代码和示例,它现在是如何工作的,以及它需要如何工作 xml布局源: <?xml versio

我正在开发一个应用程序,遇到了一个问题

我有一个视图,如下图所示,在正确的位置有一个图像和一个edittext字段。但当我点击edittext字段,它得到焦点时,它会向上推另一个视图

我有全屏标志,如果我不使用它,它工作得很完美,图像保持其位置,不会向上推。我需要有全屏标志的

有没有人能举个例子或者帮助我。我已将“WindowsOfInputMode”与所有posibles值一起使用

这里是我的布局代码和示例,它现在是如何工作的,以及它需要如何工作

xml布局源:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="top"
    android:fillViewport="true"
    android:orientation="vertical"
    android:scrollbarStyle="insideOverlay"
    android:scrollbars="vertical|none" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <!-- layout for images -->
        <RelativeLayout
            android:id="@+id/imageview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:gravity="top" >

            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:background="@drawable/image"
                android:contentDescription="TODO"/>

        </RelativeLayout>

        <!-- layout for edit text -->
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:gravity="bottom" 
            android:layout_alignTop="@id/imageview"
            >

            <EditText
                android:id="@+id/tekstbox"
                android:imeOptions="flagNoExtractUi"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:inputType="text" />

        </RelativeLayout>

    </RelativeLayout>

</RelativeLayout>

以下是我在活动中如何开始的图像

当我单击edittext字段时,我希望我的视图做出如下反应:

但当edittext获得焦点时,它会将所有内容向上推,如下所示:

有人知道如何在全屏显示的情况下解决这个问题吗


谢谢。

在活动标签中的清单文件中添加以下行:

 android:windowSoftInputMode="adjustPan|stateHidden"

在Manifest.xml中使用这行代码。在发生问题的活动中

 <activity

           android:windowSoftInputMode="stateVisible|adjustNothing">  

  </activity>


在活动标记中的清单文件中添加以下行:

 android:windowSoftInputMode="adjustPan|stateHidden"
android:WindowsOfInputMode=“adjustResize”

并在布局文件中添加
ScrollView
,如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical|none" >

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <!-- layout for images -->
    <RelativeLayout
        android:id="@+id/imageview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:gravity="top" >

        <ImageView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:background="@drawable/image"
            android:contentDescription="TODO"/>

    </RelativeLayout>

    <!-- layout for edit text -->
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="bottom" 
        android:layout_alignTop="@id/imageview"
        >

        <EditText
            android:id="@+id/tekstbox"
            android:imeOptions="flagNoExtractUi"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="text" />

    </RelativeLayout>

  </RelativeLayout>

 </ScrollView>

</RelativeLayout>


谢谢,这是一大步,但当我现在开始活动时,我的编辑文本总是覆盖在图像上。它不再俯卧撑了,但它的位置不对。是的,我把它插在那里了。还可以使用:android:theme=“@android:style/theme.Black.NoTitleBar.Fullscreen”不知道是否存在该问题?第二个布局中的android:layout_=“@+id/imageview”我尝试了您的答案,并按预期将编辑文本放置在图像下方。但屏幕使用的是全高。我需要第二个relativeLayout放在屏幕底部。你知道怎么做吗?只有这样,你才能通过使用一些视图(如文本视图)在那里创建空间。它的可见性是不可见的。你找到解决方案了吗?没有,我还没有。