澎湃 OS2(Android15)输入框文字不居中?

60 天前
 SilentOrFight

设备:Redmi K60 系统:2.0.202.0.VMNCNXM Android 15

在 Android stduio 新建一个 Android 项目,选择 java 语言,其他默认自动生成的代码不变,targetSdk 和 compileSdk 都是 35 (对应 Android 15 ),MainActivity 页面写了一个输入框,发现输入框的文字不居中(光标倒是居中了)。如果把 targetSdk 和 compileSdk 改为 34 就居中了,这是啥 bug 啊。这里有澎湃的攻城狮吗?

xml 布局代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="下面黄色区域是个居中的输入框"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.appcompat.widget.AppCompatEditText
        android:id="@+id/b"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_marginTop="40dp"
        android:layout_marginStart="37dp"
        android:layout_marginEnd="37dp"
        android:background="@android:color/holo_orange_light"
        android:gravity="center"
        android:hint="请输入文字"
        android:paddingStart="42dp"
        android:paddingEnd="42dp"
        android:textColor="#000000"
        android:textColorHint="#999999"
        android:textSize="15sp"
        app:layout_constraintTop_toBottomOf="@+id/a" />

</androidx.constraintlayout.widget.ConstraintLayout>

设备测试截图:

2320 次点击
所在节点    Android
16 条回复
hugozach
60 天前
那咋办? margin 设置个负值
lscho
59 天前
看起来不是居中的吗?
Yserver
58 天前
@lscho 感觉高了一点
Zy143L
58 天前
是否和全面屏虚拟按键有冲突呢
brsyrockss
58 天前
@lscho 你要是澎湃的工程师那太合理了
lscho
58 天前
@brsyrockss 尬了,op 说不居中,我一直在看左右居中,没想到是垂直没居中
Nyeshuai
58 天前
看样子是了,expo go 扫 react-native 文档 TextInput 就能复现,不光不居中,还可以上下滑动,一看就是魔改不到位,小米头头真是顶级草包,社区反馈也没响应。
SilentOrFight
57 天前
@Zy143L #4 应该不是,把项目改成 api34 ( Android 14 )编译,在红米 Android 15 系统上就是垂直居中的。
而且同样的代码在 api35 ( Android 15 )编译,在原生 pixel 、vivo 上的 Android 15 系统上都是垂直居中的。
控制变量下,只有澎湃 OS 出现显示错误。
SilentOrFight
57 天前
@lscho #6 是我的锅,没说清楚
SilentOrFight
57 天前
@hugozach #1 不是,只有澎湃出问题。。。我不可能给它的错误去适配
SilentOrFight
57 天前
@Nyeshuai #7 自从重心往造车去了,系统真的越来越差了(红米、vivo 双持的真实体验)
entro
57 天前
是的,之前用 m3 发现光标垂直不居中,研究了一下午,才发现只有 hyperos 有这个问题
SilentOrFight
57 天前
@Zy143L #4 哇擦,好像真的是虚拟键的问题!!!改成全面屏手势就好了
SilentOrFight
57 天前
@SilentOrFight #13 🌶︎🐔澎湃
Nyeshuai
57 天前
@SilentOrFight #11 说不定以前就是这样呢, 只不过现在外显了
SilentOrFight
57 天前
@entro #12 搞不懂也改不动,就这🌶︎🐔澎湃会这样

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1147736

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX