XML : Android, keep buttons from ignoring parent padding?

I have a scroll view inside which is a linear layout and inside the linear layout there are some buttons. I defined some padding for linear layout, but when scrolling, buttons ignore that and overlap the scroll view. What to do? here is the xml:

   <ScrollView  android:id="@+id/scrollView2"  android:layout_width="0dp"  android:layout_height="140dp"  android:layout_weight="1"  android:background="@drawable/item"  android:fadeScrollbars="false"  android:fadingEdge="none" >    <LinearLayout      android:layout_width="fill_parent"      android:layout_height="wrap_content"      android:gravity="center"      android:layout_marginLeft="8dp"      android:layout_marginRight="8dp"      android:layout_marginTop="8dp"      android:layout_marginBottom="8dp"      android:background="@drawable/item"      android:orientation="vertical">          <Button          android:id="@+id/Button03"          android:layout_width="fill_parent"          android:layout_height="50dp"          android:background="#ff0000"          android:text="Button" />      <View          android:layout_width="match_parent"          android:layout_height="1dp"          android:background="#1e90ff"/>        <Button          android:id="@+id/Button02"          android:layout_width="fill_parent"          android:layout_height="50dp"          android:background="#ff0000"          android:text="Button" />      <View          android:layout_width="match_parent"          android:layout_height="1dp"          android:background="#1e90ff"/>        <Button          android:id="@+id/Button01"          android:layout_width="fill_parent"          android:layout_height="50dp"          android:background="#ff0000"          android:text="Button" />      <View          android:layout_width="match_parent"          android:layout_height="1dp"          android:background="#1e90ff"/>        <Button          android:id="@+id/button1"          android:layout_width="fill_parent"          android:layout_height="50dp"          android:background="#ff0000"          android:text="Button" />    </LinearLayout>    

No comments:

Post a Comment