如何修复文本视图?

发布于 2025-02-04 19:31:46 字数 2291 浏览 1 评论 0原文

我的预览XML有问题,cardView在模拟器上完美显示,但在手机上没有显示。

我喜欢第一个textView在右侧,第二个textView在左侧。

我的手机在希伯来语中。

Android Studio:

“

但是在我的手机上,我看到了(Galaxy Note 5 Ultra):

“

我该如何解决?

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:cardCornerRadius="6dp"
    android:elevation="6dp"
    app:cardUseCompatPadding="true">

    <LinearLayout
        android:layout_width="372dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:orientation="vertical"
        android:background="@color/white">

        //airplane

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/airplanetitl"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:padding="1dp"
                android:text="Airplane:"
                android:textColor="@color/black"
                android:textSize="26sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/Airplanename"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="8dp"
                android:text="676"
                android:textColor="@color/black"
                android:textSize="26sp" />


        </LinearLayout>

                

I have a problem on my preview XML, the cardview shows perfectly on the emulator but not on my phone.

I like the first textview to be on the right side and the second textview to be on the left side.

My phone is in Hebrew.

Android Studio:

Android Studio

But on my phone, I see it like that (Galaxy Note 5 Ultra):

Galaxy Note 5 Ultra

How can I fix that?

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:cardCornerRadius="6dp"
    android:elevation="6dp"
    app:cardUseCompatPadding="true">

    <LinearLayout
        android:layout_width="372dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:orientation="vertical"
        android:background="@color/white">

        //airplane

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/airplanetitl"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:padding="1dp"
                android:text="Airplane:"
                android:textColor="@color/black"
                android:textSize="26sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/Airplanename"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="8dp"
                android:text="676"
                android:textColor="@color/black"
                android:textSize="26sp" />


        </LinearLayout>

                

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文