1

I have a relative layout with 16dp padding that contains (among other things) a button with the following dimensions:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:padding="16dp">

    <Button
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:text="@string/btn_next"
        android:id="@+id/btn_next"
        style="@style/myStyle"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>

On a nexus 5 it appears as expected: How it appears on a nexus 5

However on a Samsung Galaxy S5 the right side seems to get cut off: How it appears on an S5

I know Samsung likes to make weird changes to Android, but I didn't think it would affect the way views are displayed. Anyone else encountered this issue?

EDIT 1: I've included the style the button utilizes, but there are other areas of my app where this is occurring (like TextViews with match_parent width).

    <style name="myStyle" parent="My.Button">
        <item name="android:textColor">@color/primary_button_text_selector</item>
        <item name="android:background">@drawable/primary_button_selector</item>
    </style>
Kurian Vithayathil
  • 807
  • 2
  • 7
  • 20
  • Could you please also post `myStyle` style code? Thanks! – fasteque Jan 06 '15 at 17:46
  • Ok thanks, it was just to make sure you didn't have any positioning declaration in the style. Did you try to use `layout_margin` instead of padding? – fasteque Jan 06 '15 at 18:34
  • 1
    using `layout_margin` on the viewgroup or the button? What's really puzzling me is the fact that the nexus 5 respects `android:padding` attribute but the S5 doesn't. The only "work around" i see so far is adding `android:layout_alignParentLeft/Right="true"` to everything, but that's a pretty ugly solution. – Kurian Vithayathil Jan 06 '15 at 18:54
  • Add it to the `RelativeLayout` removing the `padding` setting. – fasteque Jan 06 '15 at 18:56
  • I'll try that but, im lost how this doesn't work properly on an S5. Just tested it on an Xperia Z2 and it works perfectly. – Kurian Vithayathil Jan 06 '15 at 21:11

0 Answers0