Reputation: 4586
I am using the SupportMapFragment to display a static map in a ScrollView.
When I am scrolling down/up the map shakes inside its bounds, it feels pretty laggy. My question is, how to remove these shakes when scrolling
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/planebg"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/category_image_tab"
android:layout_width="match_parent"
android:layout_height="70dp"
android:scaleType="fitXY"
android:src="@drawable/activity_details" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.jpardogo.listbuddies.lib.views.ListBuddiesLayout
xmlns:listbuddies="http://schemas.android.com/apk/res-auto"
android:id="@+id/listbuddies"
android:layout_width="400dip"
android:layout_height="400dip"
android:layout_gravity="center"
android:layout_marginTop="-230dip"
android:orientation="horizontal"
android:rotation="90" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:orientation="horizontal" >
<ImageView
android:id="@+id/booknow"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_marginRight="10dip"
android:layout_weight="2"
android:scaleType="fitXY"
android:src="@drawable/book_now" />
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_marginRight="5dip"
android:layout_weight="3"
android:orientation="horizontal" >
<ImageView
android:layout_width="0dip"
android:layout_height="45dip"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/facebook" />
<ImageView
android:layout_width="0dip"
android:layout_height="45dip"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/twitter" />
<ImageView
android:layout_width="0dip"
android:layout_height="45dip"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/mail" />
<ImageView
android:layout_width="0dip"
android:layout_height="45dip"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/cross" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dip"
android:background="@drawable/layout_bgg"
android:orientation="vertical" >
<!-- <TextView -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_marginLeft="5dip" -->
<!-- android:layout_marginTop="15dip" -->
<!-- android:textColor="#ffffff" -->
<!-- android:textSize="22sp" /> -->
<TextView
android:id="@+id/packageTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="5dip"
android:textColor="#ffffff"
android:textSize="22sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/textbg" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dip"
android:text="Price"
android:textColor="#000000"
android:textSize="22sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:orientation="vertical" >
<TextView
android:id="@+id/adult_ratetxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Adult:"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/child_ratetxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Child:"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/saveupTo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(Save up to 40% of our regular rate)"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="(Kids 4 and under: Free)"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tax not included"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:scaleType="fitXY"
android:layout_height="65dip"
android:src="@drawable/trip_adv" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="250dip"
android:layout_marginTop="5dip"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/textbg" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dip"
android:text="Description:"
android:textSize="24sp" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip" >
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:maxLines="25"
android:textSize="14sp" />
</ScrollView>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/textbg" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="5dip"
android:layout_marginLeft="10dip"
android:text="Location"
android:textSize="24sp" />
</RelativeLayout>
<TextView
android:id="@+id/addrTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_marginLeft="10dip"
android:textSize="14sp" />
<FrameLayout
android:id="@+id/map_layout"
android:layout_width="match_parent"
android:layout_height="300dp" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="300dip"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@android:color/transparent" />
<!-- <View -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="300dp" -->
<!-- android:background="@android:color/transparent" /> -->
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dip" >
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Upvotes: 1
Views: 979
Reputation: 31
If found this answer helpful: https://stackoverflow.com/a/17315956/3353347
Essentially by adding a negative top and bottom margin the shuddering still occurs, but without the black/grey bars appearing at the top and bottom so it's not as noticeable.
Upvotes: 2