I have a layout as shown below. It is inflated by code and added to a HorizontalScrollView, sometimes a few hundred times, and causing getting memory issues.
I'm wondering if there's anything that can be done to make it more efficient? Originally I used LinearLayouts, and replacing that with RelativeLayout made a huge difference to the scrolling. Now I'm wondering if it can be further improved?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="156dp"
android:layout_height="254dp"
android:paddingLeft="7dip"
android:paddingRight="7dip">
<FrameLayout android:id="@+id/button_frame"
android:layout_width="156dp"
android:layout_height="218dp">
<ImageView android:id="@+id/button_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/image_bg"
/>
<ImageView android:id="@+id/button_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom|right"
/>
<TextView android:id="@+id/button_select"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:background="@drawable/btn_selector_bg_selected"
/>
<TextView android:id="@+id/button_selected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginLeft="2dip"
android:layout_marginRight="2dip"
android:background="@drawable/title_bg_selected"/>
</FrameLayout>
<TextView
android:id="@+id/button_title"
android:layout_width="156dp"
android:layout_height="36dp"
android:textColor="#ffffff"
android:singleLine="true"
android:textSize="13sp"
android:textStyle="bold"
android:gravity="center_vertical|left"
android:ellipsize="end"
android:paddingLeft="30dip"
android:paddingRight="5dip"
android:layout_below="@id/button_frame"
android:background="@drawable/title_bg"/>
</RelativeLayout>
The ImageView button_image is populated using AQuery image caching, so I'm not sure if there's much more I can do to improve the way the image is handled. But any tips on improvements greatly appreciated.