输入文本字段不显示在Gingerbread及其下方输入的文本?

时间:2014-05-03 12:12:19

标签: android xml android-edittext

我有给定xml文件的编辑文本


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/mainbg"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight=".5"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/user_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight="0.1"

                android:ems="10"
                android:hint="Full Name"
            android:singleLine="true"
                 />

            <EditText
                android:id="@+id/user_add"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight="1"
                android:ems="10"
                android:gravity="top"
                android:hint="Address"
                android:inputType="textMultiLine"
                android:ellipsize="end"
                 />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="5dp"
            android:layout_weight=".1" >

            <Button
                android:id="@+id/user_area"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="30"
                android:hint="Area"
                android:textColor="#006999"
                android:textCursorDrawable="@null" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="17"
                android:orientation="vertical" >
            </LinearLayout>

            <EditText
                android:id="@+id/user_city"
                android:layout_width="141dp"
                android:layout_height="match_parent"
                android:layout_weight=".5"
                android:ems="10"
                android:hint="City"
                android:textColor="#006999"
                android:textCursorDrawable="@null" >

                <requestFocus />
            </EditText>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight=".4"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/user_email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight="1"
                android:ems="10"
                android:hint="Email"
                android:textColor="#006999"
                android:textCursorDrawable="@null" />

            <EditText
                android:id="@+id/user_phone_no"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight="1"
                android:ems="10"
                android:hint="Phone Number"
                android:inputType="number"
                android:textColor="#006999"
                android:textCursorDrawable="@null" />

            <EditText
                android:id="@+id/user_its_code"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:layout_weight="1"
                android:ems="10"
                android:hint="ITS/Ejamaat Number"
                android:inputType="number"
                android:textColor="#006999"
                android:textCursorDrawable="@null" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight=".2"
            android:orientation="vertical" >
        </LinearLayout>

        <RelativeLayout
            android:id="@+id/InnerRelativeLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_gravity="center"
            android:gravity="center" >

        <Button 

            android:id="@+id/btn_save"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Save"
             >
        </Button>



    </RelativeLayout>
    </LinearLayout>

</LinearLayout>

它在ICS和JellyBean中工作得非常好,但在Gingerbread / Froyo等中,编辑文本不可编辑(编辑文本中未显示任何用户输入)。我对这种奇怪的行为毫无头绪。 请帮忙

2 个答案:

答案 0 :(得分:1)

不知道你为什么会遇到这个奇怪的问题,我已经使用API​​ 8在Android 2.2 Froyo上测试了你的代码,它运行得很完美。如果您在模拟器上进行测试,我建议您从模拟器中卸载您的应用程序,而不是再次尝试部署和测试它。

答案 1 :(得分:0)

请在模拟器中发布的设备上试用此代码。不要为这段代码感到恐慌。

相关问题