键盘重叠EditText

时间:2013-03-21 11:42:03

标签: android android-edittext

当我点击Edittext键盘与编辑文本重叠时,我在此XML文件中使用以下XML文件

XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent" 
    android:layout_weight="1"
    android:background="@drawable/blue_bg"

    >

    <!-- Menu Panel -->
    <RelativeLayout
           android:id="@+id/menuPanel"
           android:layout_height="match_parent"
           android:layout_width="wrap_content"
           android:gravity="right"
           android:background="#52555a"
           android:orientation="vertical" >

            <TextView
                android:id="@+id/menu_title_1"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="0dp" 
                android:paddingLeft="15dp"             
                android:gravity="center_vertical"
                android:background="#353535"
                android:textColor="@android:color/white"
                android:text="@string/menu_title">     
            </TextView>

            <View
                android:id="@+id/menu_item_divider_1"
                android:layout_width="fill_parent"
                android:layout_height="0.5dp"
                android:layout_marginLeft="0dp"
                android:layout_marginRight="0dp"
                android:layout_below="@+id/menu_title_1"
                android:background="#b5b5b5"/>

             <ListView 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/menu_item_divider_1"
                android:dividerHeight="1dp"
               android:id="@+id/list"
                ></ListView>
            </RelativeLayout>

       <!-- Sliding Panel -->     

        <LinearLayout
            android:id="@+id/slidingPanel"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/background"
            android:gravity="left"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/header"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:background="@drawable/file" >

                <View
                    android:id="@+id/header_vertical_divider_1"
                    android:layout_width="2dp"
                    android:layout_height="fill_parent"
                    android:layout_alignParentTop="true"
                    android:layout_marginLeft="15dp"
                    android:layout_toRightOf="@+id/menuViewButton"
                    android:background="@drawable/engraved_bg" />

                <ImageView
                    android:id="@+id/menuViewButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="15dp"
                    android:clickable="true"
                    android:contentDescription="@string/description"
                    android:onClick="slidewindow"
                    android:src="@drawable/icon_menu"
                    android:visibility="visible" />

                <ImageView
                             android:id="@+id/logo"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             android:layout_centerHorizontal="true"
                             android:layout_centerVertical="true"
                             android:src="@drawable/sislogo"
                             />

            </RelativeLayout>

            <View
                android:id="@+id/dividerHeaderBottom"
                android:layout_width="fill_parent"
                android:layout_height="1dp"
                android:background="#414141" />

            <ImageView
                android:id="@+id/clientlogo"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                 android:scaleType="fitXY" />

              <RelativeLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:background="@drawable/rounded_edittext"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginBottom="5dp"
         android:paddingBottom="15dp"
         android:layout_marginTop="15dp"
         android:layout_weight="25"
        >

        <EditText
            android:id="@+id/newuser"
            style="@style/edittxt1"
            android:layout_below="@+id/olduser"
            android:layout_centerHorizontal="true"
            android:visibility="invisible"
                >
              <requestFocus />
        </EditText>

        <EditText
            android:id="@+id/confirmuser"
           style="@style/edittxt1"
            android:layout_below="@+id/newuser"
            android:layout_centerHorizontal="true" 
            android:visibility="invisible"
                   >
              <requestFocus />
        </EditText>

        <Button
            android:id="@+id/changedetails"
            style="@style/btnstyle"
            android:layout_below="@+id/confirmuser"
            android:layout_centerHorizontal="true"
            android:background="@drawable/button_sytle"
            android:onClick="usernamepassword"
            android:text="Enter" 
            android:visibility="visible"
            android:paddingLeft="20dp"
            android:paddingRight="20dp"
            android:layout_marginTop="20dp"
            />

        <Spinner
            android:id="@+id/manageaccounts"
             style="@style/spinnerstyle"
              android:layout_below="@+id/imageView1"

            />

        <EditText
            android:id="@+id/olduser"
            style="@style/edittxt1"
            android:layout_below="@+id/manageaccounts"
            android:layout_centerHorizontal="true"
            android:visibility="invisible"
                  >
              <requestFocus />
        </EditText>

   <ListView
            android:id="@+id/linkedparents"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/manageaccounts"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="15dp" 

            android:visibility="invisible"
            >
        </ListView> 

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
             android:background="@drawable/containerheader"></ImageView>

        <TextView
            android:id="@+id/textView1"
              style="@style/mainlbl"
            android:layout_alignBottom="@+id/imageView1"
            android:layout_alignLeft="@+id/manageaccounts"
            android:text="Manage Account(s)" 
            android:layout_marginBottom="5dp"

            />

   </RelativeLayout>
    <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" 
          android:layout_weight="1"
          android:gravity="bottom">

          <RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="30dp" 
          android:gravity="bottom"
          android:background="@drawable/bottom_bar">

          <ImageView
           android:id="@+id/imageView3"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignParentLeft="true"
           android:layout_marginBottom="3dp"
           android:layout_marginLeft="10dp"
           android:src="@drawable/hom" 
           android:onClick="HOME"
           />

          <ImageView
           android:id="@+id/imageView4"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignParentRight="true"
           android:layout_alignTop="@+id/imageView3"
           android:layout_marginRight="5dp"
           android:layout_marginBottom="3dp"
           android:src="@drawable/logout" 
            android:onClick="Logout"
           />
             </RelativeLayout>
        </LinearLayout>
        </LinearLayout>

</FrameLayout>

我正在使用每个edittext的requesfocous我希望edittext在我点击edittext框时向上移动我该如何实现这一点。

1 个答案:

答案 0 :(得分:4)

为清单中的活动设置此属性

android:windowSoftInputMode="stateVisible|adjustPan"

如果有效,请分享

相关问题