AdjustPan推动我的布局并隐藏状态栏 [英] adjustPan pushing my layout and hiding status bar

查看:129
本文介绍了AdjustPan推动我的布局并隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在清单中使用AdjustPan会将我的布局推到顶部,并使我的UI看起来很荒谬.

Using adjustPan in manifest pushes my layout to the top and makes my UI look ridiculous.

这是我的Android清单:

This is my Android manifest:

<activity
        android:name=".AddNote"
        android:label="@string/title_activity_add_note"
        android:windowSoftInputMode="stateVisible|adjustPan">

这是我的XML文件:

<LinearLayout 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:orientation="vertical"
tools:context="com.dinosaur.cwfei.materialnotes.AddNote">

<include
    android:id="@+id/app_bar"
    layout="@layout/app_bar_no_spinner" />

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/cardview_margin">
        <ScrollView
            android:id="@+id/scroll_view"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
          >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="@dimen/activity_vertical_margin"
            android:orientation="vertical">

            <EditText

                android:id="@+id/editTextTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/margin_16"
                android:background="@color/transparent"
                android:hint="@string/hint_title"
                android:textStyle="bold" />

            <EditText

                android:id="@+id/editTextDescription"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/transparent"
                android:hint="@string/hint_note" />

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_marginBottom="@dimen/margin_16"
                android:layout_marginTop="100dp"
                android:background="@color/divider_color" />

        </LinearLayout>
        </ScrollView>
    </android.support.v7.widget.CardView>

</LinearLayout>

推荐答案

通过使用AdjustResize而不是AdjustPan解决了该问题,请在fitReSystem无效的情况下设置fitsSystemWindows ="true".

Solved it by using adjustResize instead of adjustPan, set fitsSystemWindows="true" in case adjustResize was not working.

这篇关于AdjustPan推动我的布局并隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆