Sunday, 10 August 2014

UI looks different on Samsung device



I have an issue where UI of android application looks different on my Samsung Galaxy S5 comparing to other devices such as Nexus5 or Sony Xperia or others..


I have TextViews which arranged inside a TableLayout. Each TextView has rectangle with little stroke drawable background which is defined in separate xml.


The problem is that you can see the stroke of the left side of the rectangle but the right side seems to be hidden like it wider than the screen. I tried to load a picture but I don't have enough reputation for this.


As I said, it only happens in my Samsung device while on other devices it looks just fine.


Please refer to the layout xml and to the background drawable xml.


Can anyone explain why this and maybe can advise for a solutions?


Here is layout xml's:



<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
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"/>


Thanks in advance! Moti.


No comments:

Post a Comment