澎湃 OS2(Android15)输入框文字不居中? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
SilentOrFight
V2EX    Android

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

  •  
  •   SilentOrFight 78 天前 2447 次点击
    这是一个创建于 78 天前的主题,其中的信息可能已经有所发展或是发生改变。

    设备: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> 

    设备测试截图: screenshot

    16 条回复    2025-07-28 18:27:40 +08:00
    hugozach
        1
    hugozach  
       78 天前
    那咋办? margin 设置个负值
    lscho
        2
    lscho  
       78 天前
    看起来不是居中的吗?
    Yserver
        3
    Yserver  
       77 天前
    @lscho 感觉高了一点
    Zy143L
        4
    Zy143L  
       77 天前 via Android
    是否和全面屏虚拟按键有冲突呢
    brsyrockss
        5
    brsyrockss  
       77 天前
    @lscho 你要是澎湃的工程师那太合理了
    lscho
        6
    lscho  
       77 天前
    @brsyrockss 尬了,op 说不居中,我一直在看左右居中,没想到是垂直没居中
    Nyeshuai
        7
    Nyeshuai  
       77 天前
    看样子是了,expo go 扫 react-native 文档 TextInput 就能复现,不光不居中,还可以上下滑动,一看就是魔改不到位,小米头头真是顶级草包,社区反馈也没响应。
    SilentOrFight
        8
    SilentOrFight  
    OP
       76 天前
    @Zy143L #4 应该不是,把项目改成 api34 ( Android 14 )编译,在红米 Android 15 系统上就是垂直居中的。
    而且同样的代码在 api35 ( Android 15 )编译,在原生 pixel 、vivo 上的 Android 15 系统上都是垂直居中的。
    控制变量下,只有澎湃 OS 出现显示错误。
    SilentOrFight
        9
    SilentOrFight  
    OP
       76 天前
    @lscho #6 是我的锅,没说清楚
    SilentOrFight
        10
    SilentOrFight  
    OP
       76 天前
    @hugozach #1 不是,只有澎湃出问题。。。我不可能给它的错误去适配
    SilentOrFight
        11
    SilentOrFight  
    OP
       76 天前
    @Nyeshuai #7 自从重心往造车去了,系统真的越来越差了(红米、vivo 双持的真实体验)
    entro
        12
    entro  
       76 天前
    是的,之前用 m3 发现光标垂直不居中,研究了一下午,才发现只有 hyperos 有这个问题
    SilentOrFight
        13
    SilentOrFight  
    OP
       76 天前
    @Zy143L #4 哇擦,好像真的是虚拟键的问题!!!改成全面屏手势就好了
    SilentOrFight
        14
    SilentOrFight  
    OP
       76 天前
    @SilentOrFight #13 澎湃
    Nyeshuai
        15
    Nyeshuai  
       76 天前
    @SilentOrFight #11 说不定以前就是这样呢, 只不过现在外显了
    SilentOrFight
        16
    SilentOrFight  
    OP
       75 天前
    @entro #12 搞不懂也改不动,就这澎湃会这样
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2636 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 28ms UTC 06:30 PVG 14:30 LAX 23:30 JFK 02:30
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86