我的XML code是这里,
My xml code is here,
<?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:id="@+id/mainlayout" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/toplayout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:src="@drawable/bg" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:id="@+id/bottomlayout">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Enter value" />
</LinearLayout>
当我执行,我得到了这个样子,
when i execute , i got like this,
执行后,当我进入上编辑文本的价值,虚拟键盘打开,整个mainlayout是向上滚动,我有这样的
after execute , when i enter the value on edit text ,the virtual keyboard is open and the entire mainlayout is scroll up, i got like this
但我除外,顶部布局不向上滚动,只有底部布局或TextView的向上滚动。我希望这样的,
But i except , the top layout not to scroll up , only the bottom layout or textview scroll up. i expect like this,
如何滚动唯一的编辑视图时打开虚拟键盘。 ?
how to scroll only the edit view when open the virtual keyboard. ?
试试这个;也许是有用的。调整清单
文件
Try this; maybe it is useful. Adjust the manifest
file
<activity
android:windowSoftInputMode="adjustResize"
android:name=".youractivity" android:label="@string/app_name" >
@Ganesh更改清单
像上面的活动
code也正在
@Ganesh you change manifest
like above your Activity
code also working
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/toplayout">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<EditText
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:hint="Enter value" />
</RelativeLayout>
</LinearLayout>
上一篇:java.lang.NoClassDefFoundError的:android.support.v7.appcompat.R $设置样式样式、NoClassDefFoundError、lang、jav
下一篇:我该怎么办:这需要android.permission.INTERACT_ACROSS_USERS_FULL我该、android、INTERACT_ACROSS_USERS_FULL、permissi