Android 单击“我的客户”对话框按钮后,我的应用程序屏幕位置会发生变化

Android 单击“我的客户”对话框按钮后,我的应用程序屏幕位置会发生变化,android,position,screen,Android,Position,Screen,我使用包含多个字段的表单创建应用程序,其中一个字段显示对话框,但如果我在最新项目中显示对话框ok按钮屏幕中移动到first或其他edittext 和屏幕位置的变化。 我不会在点击按钮后改变屏幕位置 谢谢你的帮助 这是我的布局代码: ** <?xml version="1.0" encoding="utf-8"?>** <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:t

我使用包含多个字段的表单创建应用程序,其中一个字段显示对话框,但如果我在最新项目中显示对话框ok按钮屏幕中移动到first或其他edittext 和屏幕位置的变化。 我不会在点击按钮后改变屏幕位置

谢谢你的帮助 这是我的布局代码:

**    <?xml version="1.0" encoding="utf-8"?>**
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
tools:context=".SabtTavalodActivity" >

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/linearasli"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center|top"
    android:gravity="center|right"
    android:orientation="vertical" >

<RelativeLayout
    android:id="@+id/spinnerRel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/txtheadermonasebat"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="right"

        android:text="MOnasebat: " />

    <Spinner
        android:id="@+id/spinner"
        style="@style/SpinnerCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/txtheadermonasebat"
        android:layout_toLeftOf="@+id/txtmonasebat"

        />
    <!-- android:entries="@array/moshakhasat"  -->

    <TextView
        android:id="@+id/txtmonasebat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/spinner"
        android:layout_alignBottom="@+id/spinner"
        android:layout_alignParentRight="true"
        android:layout_marginRight="24dp"
        android:gravity="right"
        android:text="monasebat: " />

</RelativeLayout>

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/txtname"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:text="Name: " />

    <EditText
        android:id="@+id/name"
        android:inputType="text"
        style="@style/EditTextCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:textColorHint="#cacaca"
        android:ems="10"
        android:singleLine = "true"
        android:maxLines = "1"
        android:lines = "1"
        >

    </EditText>
<!-- 
    <QuickContactBadge
        android:id="@+id/quickContactBadge1"
        android:layout_width="75dp"
        android:layout_height="75dp"
        android:layout_alignParentBottom="true"
        android:layout_toLeftOf="@+id/name" 
        android:src="@drawable/rihanna"
        ></QuickContactBadge>
****


**

**

尝试固定大小…可能这个小部件的属性是wrap\u内容,您是否使用相对布局?你能在这里发布你的代码来了解你有什么问题吗?请发布你的代码!我在单击按钮显示对话框时发布布局文件,然后单击确定按钮仅运行dismis()方法
    <LinearLayout

            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dip"
            android:background="@drawable/image_bg"
            android:layout_alignParentBottom="true"
            android:layout_toLeftOf="@+id/name"
            android:layout_marginTop="55sp"
            android:padding="3dip" >


    <ImageView
        android:id="@+id/imgvw32"
        android:layout_width="65dip"
        android:layout_height="65dip"

        android:contentDescription="@string/axpick"
         android:src="@drawable/rihanna" 
        android:scaleType="fitXY"/>
</LinearLayout>


</RelativeLayout>
**<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:layout_marginTop="15sp">

    <TextView
        android:id="@+id/txtBirtday"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:paddingTop="10dp"
        android:text="Birtday: " />

    <Button
        android:id="@+id/btnDatePicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginTop="55dip"
        android:background="@drawable/btn_add_datapicker"
        />

    <TextView
        android:id="@+id/txtsabtbirthday"
        android:background="@drawable/btn_toggle_on_focused_holo_light"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:layout_marginTop="85sp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:gravity="center"
        android:textColorHint="#cacaca" />
</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="25sp" >

    <TextView
        android:id="@+id/txtsalepish"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:text="sale pish:  " />

    <EditText
        android:id="@+id/salepish"
        android:inputType="text"
        android:paddingTop="85dip" 
        style="@style/EditTextCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:ems="10"
        android:lines="1"
        android:maxLines="1"
        android:singleLine="true"
        android:textColorHint="#cacaca" />

</RelativeLayout>

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:layout_marginTop="25sp">

    <TextView
        android:id="@+id/txtrate"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:text="alaghe be in fard:  " />

    <RatingBar
        android:id="@+id/ratingBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="65dp"
        android:progressDrawable="@drawable/heart_rate" />

</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20sp" >


     <TextView
        android:id="@+id/txtHeaderAlarm"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:text="Alarm: " />

    <CheckBox
        android:id="@+id/AlarmcheckBox1"
        style="@style/CheckBoxCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txtHeaderAlarm"
        android:text="ErsalMessage" />

    <TextView
        android:id="@+id/txtsabtAlarm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/AlarmcheckBox1"
        android:gravity="right"
        android:text="Message: "
        android:textColor="#cacaca"
        android:textSize="16dp" />
 <CheckBox
        android:id="@+id/AlarmcheckBoxTarikh"
        style="@style/CheckBoxCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txtsabtAlarm"
        android:text="ErsalMessage" />

    <TextView
        android:id="@+id/txtsabtAlarmTarikh"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/AlarmcheckBoxTarikh"
        android:gravity="right"
        android:text="Message: "
        android:textColor="#cacaca"
        android:textSize="16dp" />

     <CheckBox
        android:id="@+id/AlarmcheckBoxHardo"
        style="@style/CheckBoxCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txtsabtAlarmTarikh"
        android:text="ErsalMessage" />

     <CheckBox
         android:id="@+id/CheckBoxPickSong"
         style="@style/CheckBoxCalenderComp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/txtHeaderAlarm"
         android:layout_toLeftOf="@+id/AlarmcheckBoxTarikh"
         android:text="ErsalMessage" />

     <TextView
         android:id="@+id/TextPickSong"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/AlarmcheckBox1"
         android:layout_toLeftOf="@+id/AlarmcheckBoxTarikh"
         android:gravity="right"
         android:text="Message: "
         android:textColor="#cacaca"
         android:textSize="16dp" />

</RelativeLayout>

<RelativeLayout
    android:id="@+id/relMsg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:layout_marginTop="20sp">

    <TextView
        android:id="@+id/txtHeaderMsg"
        style="@style/sectionHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:gravity="right"
        android:text="Message: " />

    <CheckBox
        android:id="@+id/msgcheckBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        style="@style/CheckBoxCalenderComp"
        android:layout_below="@+id/txtHeaderMsg"
        android:text="ErsalMessage" />

    <TextView
        android:id="@+id/txtMSgactive"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/msgcheckBox1"
        android:gravity="right"
        android:text="Message: "
        android:textColor="#cacaca"
        android:textSize="16dp" />
    <CheckBox
        android:id="@+id/msgcheckBoxTarikh"
        style="@style/CheckBoxCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txtMSgactive"
        android:text="ErsalMessage"
         />

    <TextView
        android:id="@+id/txtMSgactiveTarikh"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/msgcheckBoxTarikh"
        android:gravity="right"
        android:text="Message: "
        android:textColor="#cacaca"
        android:textSize="16dp" />
    <CheckBox
        android:id="@+id/msgcheckBoxSaat"
        style="@style/CheckBoxCalenderComp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txtMSgactiveTarikh"
        android:text="ErsalMessage"
         />

    <TextView
        android:id="@+id/txtMSgactiveSaat"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/msgcheckBoxSaat"
        android:gravity="right"
        android:text="Message: "
        android:textColor="#cacaca"
        android:textSize="16dp" />

</RelativeLayout>

    <TextView
        android:id="@+id/txtNote"
        android:layout_width="fill_parent"
        style="@style/sectionHeader"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/padding_small"

        android:layout_marginTop="25dip"
        android:gravity="right"
        android:text="Note: " />

    <EditText
        android:id="@+id/note"
        android:inputType="text"
        style="@style/EditTextCalenderComp"
        android:layout_width="@dimen/textbox"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/padding_small"
        android:layout_marginRight="10dip"
        android:layout_marginTop="25dip"
        android:ems="10"
        android:textColorHint="#cacaca"
         />

    <Button
        android:id="@+id/btnNextScreen"
        android:background="@drawable/btn_toggle_holo_light_mosi"
        android:layout_width="@dimen/btndim"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="10dip"
        android:layout_marginTop="15dip"
        android:text="Send to Next Screen" />
</LinearLayout>