I need a list of view scrolled horizontally, so i've put LinearLayout in HorizontalScrollView and added elements to the LinearLayout. Everything is fine, but there is strange margins/padding(I don't know what it is)
This is the view fully scrolled to the left - first item is half aboard the parent
And this is the fully scrolled to the right one - strange padding on the right side
http://korniltsev.ru/m/gyazo/4d093939766fe.png
THis is my xml:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"/>
</HorizontalScrollView>
item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_height="match_parent"
>
<FrameLayout
android:layout_width="140dp"
android:layout_height="50dp"
android:background="@drawable/bg_payment_system_item"
android:layout_centerInParent="true"
>
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</FrameLayout>
<Button
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
</RelativeLayout>
Ok so this behavior is an android bug. http://code.google.com/p/android/issues/detail?id=20088
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With