[英]Layout is moving up when keyboard appears
Here is my xml file.......I am trying to build a layout where if the keyboard appears then the layout can be scrolled. 这是我的xml文件。......我正在尝试构建布局,如果出现键盘,则可以滚动布局。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:focusable="true"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:fillViewport="true"
android:focusableInTouchMode="true"
>
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight=".3"
android:background="@drawable/squareshape"
android:orientation="horizontal"
android:weightSum="4">
<TextView
android:id="@+id/priority"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginLeft="2dp"
android:drawableLeft="@drawable/flag"
android:gravity="center"
android:text="@string/setpriority"
android:textColor="@color/actionbarcolor"
android:textSize="8dp"
android:layout_weight="1.1"
android:textStyle="bold" />
<View
android:layout_width=".1dp"
android:layout_height="fill_parent"
android:layout_marginLeft="2dp"
android:layout_weight=".01"
android:background="@android:color/black"></View>
<TextView
android:id="@+id/date"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="6dp"
android:layout_marginRight="4dp"
android:layout_weight="1"
android:alpha=".5"
android:drawableLeft="@drawable/date"
android:gravity="center"
android:tag="0"
android:text="@string/setdate"
android:textColor="@color/actionbarcolor"
android:textSize="8dp"
android:textStyle="bold" />
/>
<View
android:layout_width=".1dp"
android:layout_height="fill_parent"
android:layout_marginLeft="2dp"
android:layout_weight=".01"
android:background="@android:color/black"></View>
<TextView
android:id="@+id/ime"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="6dp"
android:layout_marginRight="4dp"
android:alpha=".5"
android:layout_weight=".5"
android:drawableLeft="@drawable/time"
android:gravity="center"
android:tag="0"
android:text="@string/settime"
android:textColor="@color/actionbarcolor"
android:textSize="8dp"
android:textStyle="bold" />
/>
<View
android:layout_width=".1dp"
android:layout_height="fill_parent"
android:layout_marginLeft="2dp"
android:layout_weight=".01"
android:background="@android:color/black"></View>
<TextView
android:id="@+id/location"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:alpha=".5"
android:drawableLeft="@drawable/location"
android:gravity="center"
android:tag="0"
android:text="@string/setlocation"
android:textColor="@color/actionbarcolor"
android:textSize="8dp"
android:textStyle="bold"
android:layout_weight="1.07" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="2"
android:layout_weight="6"
android:orientation="horizontal"
android:background="@drawable/squareshape">
<EditText
android:id="@+id/newnote_edittext_note"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="match_parent"
android:background="@drawable/squareshape"
android:gravity="top" />
<ListView
android:id="@+id/listview_list"
android:layout_width="0dp"
android:layout_weight=".5"
android:layout_height="fill_parent"></ListView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_weight=".5"
android:weightSum="3">
<ImageView
android:id="@+id/imageview_addphoto"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/picturebuttonnor" />
<ImageView
android:id="@+id/imageview1_video"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/videobuttonnor" />
<ImageView
android:id="@+id/imageview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:contentDescription="newnote_imageview_audio"
android:src="@drawable/audiobuttonnor" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="false"
android:layout_alignParentBottom="true"
>
<include
android:id="@+id/include"
layout="@layout/bottomlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></include>
</LinearLayout>
</RelativeLayout>
</ScrollView>
When the keyboard appears,the layout is moving up.So the entire layout isn't scrolling.How to stop this?Please help... 当键盘出现时,布局正在向上移动。因此整个布局没有滚动。如何停止此操作?请帮助...
Try define the following attribute in of AndroidManifest.xml 尝试在AndroidManifest.xml中定义以下属性
android:windowSoftInputMode="stateVisible|adjustResize"
Specifying " adjustResize
" is important if your UI includes controls that the user might need to access immediately after or while performing text input.Fore more info check this 如果您的UI包含用户可能需要在执行文本输入后或执行操作时立即访问的控件,则指定“ adjustResize
”非常重要。有关更多信息,请检查此
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.