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