UI在三星设备上看起来不同

时间:2014-08-10 20:23:48

标签: android xml android-layout

我有一个问题,我的三星Galaxy S5上的Android应用程序的UI与其他设备(如Nexus5或Sony Xperia或其他设备)相比看起来有所不同。

我有一个安排在TableLayout内的TextViews。 每个TextView都有一个带有小笔划可绘制背景的矩形,它在单独的xml中定义。

问题是你可以看到矩形左侧的笔划,但右侧似乎隐藏得比屏幕更宽。 我试图加载图片,但我没有足够的声誉。

正如我所说,它只发生在我的三星设备上,而在其他设备上它看起来很好。

请参阅布局xml和背景drawable xml。

任何人都可以解释为什么这可能会为解决方案提供建议吗?

这是布局xml' s:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".GpsRecMain" 
android:background="@color/LightGrey">

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:stretchColumns="*.*" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TextView
            android:id="@+id/tvTimer"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/black_text_box"
            android:gravity="center"
            android:text="00:00"
            android:textColor="@color/YellowGreen"
            android:textSize="35sp"
            android:textStyle="bold" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TextView
            android:id="@+id/tvSpeed"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/black_text_box"
            android:gravity="center"
            android:text="@string/NUMERIC_ZERO"
            android:textColor="@color/YellowGreen"
            android:textSize="40sp"
            android:textStyle="bold|italic" />

        <TextView
            android:id="@+id/tvDistance"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@drawable/black_text_box"
            android:gravity="center"
            android:text="@string/NUMERIC_ZERO"
            android:textColor="@color/YellowGreen"
            android:textSize="40sp"
            android:textStyle="bold|italic" />

    </TableRow>
</TableLayout>

background xml:

<?xml version="1.0" encoding="utf-8"?>

<corners android:radius="0dp" />

<solid android:color="@color/Black"/>
<stroke android:width="3px"
        android:color="@color/YellowGreen"/>

<padding android:top="5dp"
         android:bottom="5dp"/>

提前致谢! 莫蒂。

1 个答案:

答案 0 :(得分:0)

我发现了问题!!

嗯,实际上这不是解决方案......但是当我将文本样式 italic 更改为常规时,问题就消失了!

我仍然无法理解为什么斜体它看起来不同所以我将文本更改为普通样式。

相关问题