Android 11.0 修复在录音机APK(SoundRecorder),横屏显示时录制时间不能居中

路径:packages/apps/SoundRecorder/res/layout-land/main.xml

思路:layout-land 表示横屏时选用的布局,这时在++处,将录制时间字段居中即可

android:layout_centerInParent="true"

源码:

    <RelativeLayout android:id="@+id/timerViewLayout"
        android:layout_width="match_parent"
        android:layout_height="134dip"
        android:background="@drawable/gradient_bg">

        <TextView android:id="@+id/timerView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="115dip"
++       android:layout_centerInParent="true"
            android:layout_marginTop="-4dip"
            android:layout_marginRight="10dip"
            style="@android:style/TextAppearance.Large" />

        <LinearLayout android:id="@+id/stateMessage2Layout"
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:baselineAligned="false"/>

猜你喜欢

转载自blog.csdn.net/qq_27494201/article/details/125148147