背景布局移动时,软键盘显示 - 机器人机器人、布局、键盘、背景

由网友(泼出去的姑娘嫁出去的水)分享简介:我有一个输入的弹出窗口,我显示了我的活动,具有一定的编辑框在其主视图。当弹出显示视图保持黯淡的背景下活动(像一个警告对话框)。I've got an input popup that I'm displaying over my activities main view that has some edit boxe...

我有一个输入的弹出窗口,我显示了我的活动,具有一定的编辑框在其主视图。当弹出显示视图保持黯淡的背景下活动(像一个警告对话框)。

I've got an input popup that I'm displaying over my activities main view that has some edit boxes in it. When the popup is displayed the activities view stays dimmed in the background (like with an alert dialog).

我遇到的问题是,当键盘出现的弹出是好的,但活动查看后台正在发生变化了。这种观点应该暂停,我不会想到它会受到键盘的。有什么办法来阻止这种情况发生?

The issue I'm having is that when the keyboard comes up the popup is ok, but activities view in the background is shifting up. That view should be paused and I wouldn't have thought it would be affected by the keyboard at all. Is there any way to stop this from happening?

我已经尝试添加机器人:windowSoftInputMode =adjustPan的活动,并弹出,没有运气

I've tried adding android:windowSoftInputMode="adjustPan" to the activity and to the pop-up with no luck.

下面是我的活动布局:

<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical" android:background="@drawable/main_bg">

<include android:id="@+id/header" layout="@layout/common_header" android:layout_width="fill_parent" android:layout_height="wrap_content"/>

 <RelativeLayout
  android:id="@+id/contentLayout"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_margin="5dp"
 >

<include android:id="@+id/btnBar" layout="@layout/common_button_bar" 
android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:layout_alignParentBottom="true"/>  

  <LinearLayout
   android:id="@+id/webLayout"
   android:layout_above="@+id/btnBar"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:background="@drawable/blk"
  android:layout_margin="10dp">

   <WebView
android:id="@+id/WebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="1dp"
android:background="@drawable/white"
   >


   </WebView>

  </LinearLayout>
 </RelativeLayout>
    </LinearLayout>

和这里是我的弹出式布局:

and here is my pop-up layout:

<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_height="wrap_content"
 android:orientation="vertical"
 android:background="@color/light_grey" android:layout_width="wrap_content"      android:minWidth="300dp">
 <LinearLayout
  android:id="@+id/main_inner_layout"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:background="@color/white"
  android:layout_margin="3dp"
 >

  <TextView
   android:id="@+id/enter_txt"
   android:text="Enter Cup Code Below:"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:gravity="center_horizontal"
   android:textColor="@color/black"
   android:layout_gravity="left"
   android:typeface="sans"
   android:textSize="16dp"
   android:layout_margin="10dp"
      >
  </TextView>
  <RelativeLayout
    android:id="@+id/code_layout"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_marginLeft="10dp"
   android:layout_marginRight="10dp"
   android:background="@color/white"
  >
   <EditText
    android:text="12345"
    android:id="@+id/CodeInputOne"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="10dp"
    android:layout_alignParentLeft="true"
   ></EditText>
   <EditText
    android:text="12345"
    android:id="@+id/CodeInputTwo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:layout_centerHorizontal="true"
   ></EditText>
   <EditText
    android:text="12345"
    android:id="@+id/CodeInputThree"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_alignParentRight="true"
       ></EditText>
  </RelativeLayout>
  <RelativeLayout
   android:id="@+id/btn_layout_top"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_marginLeft="10dp"
   android:layout_marginTop="10dp"
   android:layout_marginRight="10dp"
   android:background="@color/white"
  >
   <Button
    android:id="@+id/AccountBtn"
    android:textStyle="bold"
    android:text="My Account"
    android:layout_marginRight="5dp"
    android:layout_alignParentLeft="true"
    android:onClick="ClickHandler"
    android:layout_height="40dp"
    android:layout_width="130dp"
   ></Button>
   <Button
    android:id="@+id/SubmitBtn"
    android:textStyle="bold"
    android:text="Submit"
    android:layout_marginLeft="5dp"
    android:layout_alignParentRight="true"
    android:onClick="ClickHandler"
    android:layout_height="40dp"
    android:layout_width="130dp"
   ></Button>

  </RelativeLayout>
  <RelativeLayout
   android:id="@+id/btn_layout_bottom"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_marginLeft="10dp"
   android:layout_marginRight="10dp"
   android:background="@color/white"
  >
   <Button
    android:id="@+id/RewardsBtn"
    android:textStyle="bold"
    android:text="Rewards"
    android:layout_marginRight="5dp"
    android:layout_alignParentLeft="true"
    android:onClick="ClickHandler"
    android:layout_height="40dp"
    android:layout_width="130dp"
       ></Button>
   <Button
    android:id="@+id/CancelBtn"
    android:textStyle="bold"
    android:text="Cancel"
    android:layout_marginLeft="5dp"
    android:layout_alignParentRight="true"
    android:onClick="ClickHandler"
    android:layout_height="40dp"
    android:layout_width="130dp"
   ></Button>
   </RelativeLayout>
 </LinearLayout>
</LinearLayout>

谢谢!

推荐答案

尝试使用

android:windowSoftInputMode="adjustPan|adjustResize"

有关的活动。

拉​​吉

阅读全文

相关推荐

最新文章