android - EditText 中未显示额外的小数位。Android Studio + Wear 操作系统
问题描述
概括
我有一个 Wear OS 应用程序需要通过文本输入框获取用户的 IP 地址。我遇到的问题是输入完成后,键盘中的用户输入与框中的文本不匹配。所以在打字的过程中,多余的小数不显示。选中复选标记后,关闭键盘,输入框中的文本将具有这些小数。如果这没有意义,请参阅下面的 gif。
AVD 配置
Name: Wear_OS_Round_API_28
CPU/ABI: Wear OS Intel Atom (x86)
Path: C:\Users\user\.android\avd\Wear_OS_Round_API_28_1.avd
Target: android-wear [Wear OS] (API level 28)
Skin: AndroidWearRound360x360
SD Card: 512M
fastboot.chosenSnapshotFile:
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: wear_round_360
hw.lcd.width: 360
hw.rotaryInput: yes
hw.initialOrientation: Portrait
image.androidVersion.api: 28
tag.id: android-wear
hw.mainKeys: yes
hw.camera.front: emulated
avd.ini.displayname: Wear OS Round API 28
hw.gpu.mode: auto
hw.ramSize: 512
PlayStore.enabled: true
fastboot.forceColdBoot: no
hw.cpu.ncore: 4
hw.keyboard: yes
hw.sensors.proximity: yes
hw.dPad: no
hw.lcd.height: 360
vm.heapSize: 32
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
image.sysdir.1: system-images\android-28\android-wear\x86\
hw.keyboard.lid: yes
showDeviceFrame: yes
hw.camera.back: virtualscene
AvdId: Wear_OS_Round_API_28
hw.lcd.density: 240
hw.arc: false
hw.device.hash2: MD5:964d285643de951626a3e8ed7682a058
fastboot.forceChosenSnapshotBoot: no
fastboot.forceFastBoot: yes
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Wear OS
runtime.network.latency: none
disk.dataPartition.size: 2G
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
编辑文本 XML 配置
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="0dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="75dp"
android:ems="10"
android:hint="IP Address"
android:inputType="numberSigned|numberDecimal"
android:digits="0123456789."
/>
解决方案
推荐阅读
- python - 网站通过 Selenium 使用 ChromeDriver 和 Chrome 导航到无访问页面,可能受 Bot Protected
- c++ - C++ 代码在台式机上运行良好,但在笔记本电脑上却不行
- react-native - 当我们的 api 响应失败时,如何在本机反应中显示警报消息
- java - Java 7 在线程中运行选定的方法
- javascript - 即使在添加插件之后,目前也没有启用对实验性语法“类属性”的支持
- android - 经过身份验证的安全规则是否适用于 Firebase 匿名登录?
- angularjs - AngluarJS:错误:$injector:strictdi 需要显式注释
- java - 有没有办法在 Java 中获取 Cluster JVM 的详细信息
- jooq - JOOQ maven 代码生成和使用不同的数据库进行构建时和运行时
- git - 如何编辑 git rebase 内容然后通过 shell 保存?