Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何包装有编号的编辑文本?_Android - Fatal编程技术网

Android 如何包装有编号的编辑文本?

Android 如何包装有编号的编辑文本?,android,Android,我正在创建一个设置页面。因为我有很多字段,其中还有电话号码字段,我想包装这个有电话号码但没有包装的编辑文本。我有编辑文本,他们正在包装文本,但号码中有什么错误 这是我的xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutsettings"

我正在创建一个设置页面。因为我有很多字段,其中还有电话号码字段,我想包装这个有电话号码但没有包装的编辑文本。我有编辑文本,他们正在包装文本,但号码中有什么错误

这是我的xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layoutsettings"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <Button
        android:id="@+id/Button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="40sp"
        android:layout_marginRight="40sp"
        android:gravity="center_horizontal"
        android:padding="10sp"
        android:text="Signin with FB" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/UserFirstName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:hint="FName"
            android:textSize="15sp" />

        <EditText
            android:id="@+id/UserLastName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"
            android:hint="LName"
            android:textSize="15sp" />
    </LinearLayout>

    <EditText
        android:id="@+id/PhoneNumber"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:hint="PhoneNumber"
        android:inputType="number"
        android:textSize="15sp" />

    <EditText
        android:id="@+id/EmailAddress"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:hint="EmailAddress"
        android:textSize="15sp" />

    <EditText
        android:id="@+id/AddressLine1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:hint="Address Line 1"
        android:textSize="15sp" />

    <EditText
        android:id="@+id/AddressLine2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:hint="Address Line 2"
        android:textSize="15sp" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/Locality"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:hint="Locality"
            android:textSize="15sp" />

        <EditText
            android:id="@+id/City"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:hint="City"
            android:textSize="15sp" />
    </LinearLayout>

    <EditText
        android:id="@+id/PinCode"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.5"
        android:hint="PinCode"
        android:inputType="number"
        android:textSize="15sp" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/Feedback"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:text="Feedback"
            android:textSize="15sp" />

        <RatingBar
            android:id="@+id/ratingBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:numStars="5"
            android:rating="0.0"
            android:stepSize="1.0" />
    </LinearLayout>

</LinearLayout> 

请建议我怎么解决它。
谢谢。

将匹配父项更改为包装内容

我想你可以通过添加

android:phoneNumber=“true”

在XML布局中。试试这个

试试看:

<EditText
                android:id="@+id/txtFamousRegion"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="textMultiLine|number"
                android:singleLine="false"
                android:digits= "0123456789" />


Do it
wrap\u content
取而代之的是
match\u parent
很抱歉,这几乎是IDE问题在新windows的另一个项目中尝试祝你好运