如何在我的xml中爲特定值的預定義輸入創建輸入?例如,我想要一個用戶輸入可以是120/80的血壓,所以在我的輸入中,我希望用戶輸入已經放置正斜槓的輸入字段。請指教。 這是我Android預定義輸入
我到最接近的是這
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3"
android:gravity="start"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:layout_weight="0.8"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/patientBloodPressure1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:imeOptions="actionNext"
android:maxLines="1"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.45"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center"
android:padding="2dp"
android:text="@string/slash"
android:textSize="14sp"
android:textStyle="bold" />
<android.support.design.widget.TextInputLayout
android:layout_weight="0.75"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/patientBloodPressure2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:imeOptions="actionNext"
android:maxLines="1"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
讓我把它做好:你想要兩個單獨的字段除以斜槓填充默認值,而不是提示。對? – gonczor
不完全,暗示也可以工作。我只想要以上,想知道是否有更簡單的方法。 – sammyukavi