【发布时间】:2017-10-25 17:52:20
【问题描述】:
如何在我的 xml 中为特定值的预定义输入创建输入?例如,我希望用户输入可以是 120/80 的血压,所以在我的输入中,我希望用户输入一个已经放置正斜杠的输入字段。请指教。 这就是我所拥有的
我最接近的就是这个
<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>
【问题讨论】:
-
让我做对了:您希望两个单独的字段除以斜线,填充默认值而不是提示。对吗?
-
不完全是,提示也可以。我只想要上面的,想知道有没有更简单的方法。
标签: android android-layout android-xml android-input-method