1

I have a Tabhost in my app which have 5 tabs in it. I set a background image on my tabhost by putting android:background = "@drawable/background" in my xml file, but unfortunately the whole ui becomes laggy. How can I optimize the image in order to eliminate the lag in my UI? Please help me with this one.

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
android:background = "@drawable/background">

    <LinearLayout
        android:id="@+id/LinearLayout01"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#FCAFA6"
            android:orientation="vertical" >

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height= "52dp"
                android:background="@drawable/header" />

            <TextView
                android:id="@+id/tabTitle"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:gravity="center"
                android:text="Home"
                android:textColor="#FFFFFF" />
        </LinearLayout>

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1">
        </FrameLayout>

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0" >
        </TabWidget>
    </LinearLayout>

</TabHost>
KirbyAbadilla
  • 189
  • 1
  • 5
  • 16

1 Answers1

1

You have to make various device size background and put on respective folder for more check this :Android background image size in pixel

Community
  • 1
  • 1
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67