Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/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
Java 为什么在输入字段中键入时,操作栏不见了?_Java_Android_Android Layout - Fatal编程技术网

Java 为什么在输入字段中键入时,操作栏不见了?

Java 为什么在输入字段中键入时,操作栏不见了?,java,android,android-layout,Java,Android,Android Layout,为什么编辑输入字段时顶部的蓝色部分消失了?(包括图片)?我怎样才能解决这个问题 布局应为: 键入时的布局(不应该是): 我键入后的布局(不应该是): XML代码如下所示: 在此下方: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_paren

为什么编辑输入字段时顶部的蓝色部分消失了?(包括图片)?我怎样才能解决这个问题

布局应为: 键入时的布局(不应该是): 我键入后的布局(不应该是):

XML代码如下所示:
在此下方:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="nl.bosschert.john.rebornsportschallengegui.MainActivity$PlaceholderFragment">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/editTextRondes"
android:layout_alignStart="@+id/editTextRondes"
android:layout_alignTop="@+id/editTextRondes"
android:layout_marginTop="-80dp"
android:text="Hoeveel rondes heb je gemaakt?"
android:textAlignment="center"
android:textColor="@color/header"
android:textSize="@dimen/header"
android:textStyle="bold" />

<EditText
    android:id="@+id/editTextRondes"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_below="@id/editTextRondes"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="200dp"
    android:hint="Aantal rondes"
    android:textColor="@color/header"
    android:textColorHint="@color/colorRondesHint" />
</RelativeLayout>

如果您的属性不正确且不必要,请尝试以下操作:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="nl.bosschert.john.rebornsportschallengegui.MainActivity$PlaceholderFragment">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="200dp"
        android:layout_centerHorizontal="true"
        android:text="Hoeveel rondes heb je gemaakt?"
        android:textAlignment="center"
        android:textColor="@color/header"
        android:textSize="@dimen/header"
        android:textStyle="bold" />

    <EditText
        android:id="@+id/editTextRondes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/editTextRondes"
        android:layout_centerHorizontal="true"      
        android:hint="Aantal rondes"
        android:textColor="@color/header"
        android:textColorHint="@color/colorRondesHint" />

</RelativeLayout>

您的布局似乎很好,除了下面这行
android:layout_=“@id/editTextRondes”
不正确, 可能是其他代码导致了此问题。

请尝试以下操作: 修改
manifest.xml

<activity
        android:name=".xxxActivity"
        android:windowSoftInputMode="adjustResize"/>

或: 将
添加到您的RelativeLayout

<ScrollView>
   <RelativeLayout>
    ...
   </RelativeLayout>
</ScrollView>

...

kingfeng提供的答案解决了我在三星Galaxy S7上的问题,但在三星Galaxy S5和三星Galaxy S4上产生了问题

尝试以下操作:修改AndroidManifest.xml


这确实在我的星系S7上起作用,但在我的星系S4和星系S5上不起作用。。。当我删除kingfeng建议的代码时,问题只存在于我的Galaxy S7上,而在我的Galaxy S5和S4上消失了。我想是我的手机出了问题。也许这与我的自定义屏幕大小设置(HD/FHD/WQHD)有关,我可以在android 7上选择


无论如何,我决定删除ActionBar,因为我不需要它

尝试使用线性布局以避免彼此之间的相对性,因为UI并不是那么复杂。这在我的Galaxy S7上有效,但在我的Galaxy S4和Galaxy S5上无效。。。当我删除您建议的代码时,问题只存在于我的Galaxy S7上,并且在我的Galaxy S5和S4上消失。我想是我的手机出了问题。也许这与我的自定义屏幕大小设置(HD/FHD/WQHD)有关,我可以在android 7上选择。这样做并不能解决我的问题,但我认为它解决了很多即将出现的问题:)