1
\$\begingroup\$

I would like to optimize this layout to improve rendering speed. How can I remove so many unnecessary components from the layout file?

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent">

    <FrameLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/ingameFrameLayout"
        android:visibility="visible">

        <com.kyunggi.sanggeoltopia2.InGameSurfaceView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/ingameSurfaceView"/>

        <com.kyunggi.sanggeoltopia2.InGameViewOGL
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/ingameViewOGL"/>

        <LinearLayout
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"
            android:orientation="vertical"
            android:visibility="visible">

            <LinearLayout
                android:layout_height="match_parent"
                android:layout_width="wrap_content"
                android:orientation="horizontal"
                android:layout_gravity="bottom|center_horizontal"
                android:gravity="bottom|center_horizontal">

                <LinearLayout
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:orientation="horizontal">

                    <ImageButton
                        android:layout_height="50dp"
                        android:layout_width="50dp"
                        android:src="@android:drawable/ic_menu_sort_by_size"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:background="#000000"
                        android:id="@+id/ingameIBMenu"/>

                    <ImageButton
                        android:layout_height="50dp"
                        android:layout_width="50dp"
                        android:src="@drawable/tbxinxi"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:scaleType="fitXY"
                        android:background="#ED6FD7"
                        android:id="@+id/ingameIBStat"/>

                    <ImageButton
                        android:layout_height="50dp"
                        android:layout_width="50dp"
                        android:src="@android:drawable/ic_search_category_default"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:background="#0E5DEE"
                        android:scaleType="fitXY"
                        android:id="@+id/ingameIBTech"/>

                    <ImageButton
                        android:layout_height="50dp"
                        android:layout_width="50dp"
                        android:src="@drawable/nextturn_btn"
                        android:layout_marginLeft="20dp"
                        android:layout_marginRight="20dp"
                        android:background="#2AF4D8"
                        android:id="@+id/ingameIBNextTurn"
                        android:scaleType="fitXY"/>

                </LinearLayout>

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:id="@+id/ingameLLCapture">

            <ImageView
                style="?android:attr/buttonBarButtonStyle"
                android:layout_height="50dp"
                android:layout_width="50dp"
                android:src="@drawable/capture"/>

        </LinearLayout>

        <LinearLayout
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:layout_gravity="bottom|center_horizontal"
            android:gravity="bottom|center_horizontal"
            android:id="@+id/ingameLLDesc"
            android:visibility="invisible">

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:orientation="horizontal"
                android:layout_gravity="bottom|center_horizontal"
                android:gravity="center_horizontal"
                android:background="#000000"
                android:id="@+id/ingameLLDescIn">

                <ImageView
                    android:layout_height="52dp"
                    android:layout_width="50dp"
                    android:src="@drawable/burning"
                    android:id="@+id/ingameDescIvImg"
                    android:scaleType="fitXY"/>

                <LinearLayout
                    android:layout_height="match_parent"
                    android:layout_width="wrap_content"
                    android:orientation="vertical"
                    android:layout_weight="1.0">

                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="Forest,Game"
                        android:id="@+id/ingameDescTvTitle"
                        android:layout_gravity="center"
                        android:textColor="#FFFFFF"/>

                    <TextView
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:text="Tap here to extract"
                        android:id="@+id/ingameDescTvDetail"
                        android:layout_gravity="center"
                        android:textColor="#FFFFFF"/>

                </LinearLayout>

                <ImageButton
                    android:layout_height="52dp"
                    android:layout_width="52dp"
                    android:src="@drawable/x_btn"
                    android:id="@+id/ingameDescIbBack"
                    android:background="#000000"
                    android:scaleType="fitXY"/>

            </LinearLayout>

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:orientation="horizontal"
                android:layout_gravity="bottom|center_horizontal"
                android:gravity="center_horizontal"
                android:background="#000000"
                android:id="@+id/ingameLLDescInBtns">

                <ImageView
                    android:layout_height="52dp"
                    android:layout_width="50dp"
                    android:src="@drawable/burning"
                    android:id="@+id/ingameDescBtnsIvImg"
                    android:scaleType="fitXY"/>

                <LinearLayout
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:orientation="vertical">

                    <LinearLayout
                        android:layout_height="match_parent"
                        android:layout_width="wrap_content"
                        android:orientation="vertical">

                        <TextView
                            android:layout_height="wrap_content"
                            android:layout_width="wrap_content"
                            android:text="Forest,Game"
                            android:id="@+id/ingameDescBtnsTvTitle"
                            android:layout_gravity="center"
                            android:textColor="#FFFFFF"/>

                        <TextView
                            android:layout_height="wrap_content"
                            android:layout_width="wrap_content"
                            android:text="Tap here to extract"
                            android:id="@+id/ingameDescBtnsTvDetail"
                            android:layout_gravity="center"
                            android:textColor="#FFFFFF"/>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_height="wrap_content"
                        android:layout_width="wrap_content"
                        android:orientation="horizontal"
                        android:layout_weight="1.0">

                        <HorizontalScrollView
                            android:layout_height="wrap_content"
                            android:layout_width="wrap_content">

                            <LinearLayout
                                android:layout_height="wrap_content"
                                android:layout_width="wrap_content"
                                android:orientation="horizontal"
                                android:id="@+id/ingameDescBtnsLL"/>

                        </HorizontalScrollView>

                    </LinearLayout>

                </LinearLayout>

                <ImageButton
                    android:layout_height="52dp"
                    android:layout_width="52dp"
                    android:src="@drawable/x_btn"
                    android:id="@+id/ingameDescBtnsIbBack"
                    android:background="#000000"
                    android:scaleType="fitXY"/>

            </LinearLayout>

        </LinearLayout>

    </FrameLayout>

    <FrameLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/ingameFrameLayoutMenu"
        android:visibility="invisible"
        android:elevation="10dp">

        <LinearLayout
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:gravity="center_horizontal"
            android:background="#000000"
            android:alpha="0.6">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Menu"
                android:layout_marginTop="80dp"
                android:textSize="26sp"
                android:textColor="#FFFFFF"/>

            <Button
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="Exit"
                android:id="@+id/ingameBtExit"
                android:elevation="11dp"
                android:alpha="1.0"/>

        </LinearLayout>

    </FrameLayout>

    <FrameLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/ingameFrameLayoutStat"
        android:visibility="invisible">

        <LinearLayout
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:gravity="center_horizontal"
            android:background="#000000">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Game mode"
                android:layout_marginTop="80dp"
                android:id="@+id/ingameStatTVTitle"
                android:textColor="#FFFFFF"/>

            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="Text"
                android:id="@+id/ingameStatTVContent"/>

            <Button
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="Back"
                android:layout_margin="10dp"
                android:id="@+id/ingameBtStatBack"/>

        </LinearLayout>

    </FrameLayout>

    <FrameLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/ingameFrameLayoutTech"
        android:visibility="invisible"
        android:background="#FFFFFF">

        <ScrollView
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:background="#FFFFFF"
            android:layout_marginTop="40dp">

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:orientation="vertical"
                android:id="@+id/ingameLLTechContainer"/>

        </ScrollView>

    </FrameLayout>

    <LinearLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:id="@+id/ingamellVictory"
        android:gravity="top|center"
        android:background="#000000">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="VICTORY!!!"
            android:textSize="40sp"
            android:textColor="#FFFFFF"
            android:layout_marginTop="87dp"/>

        <ImageView
            android:layout_height="100dp"
            android:layout_width="100dp"
            android:src="@drawable/capture"
            android:scaleType="fitXY"/>

        <Button
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="DONE"
            android:background="#83DBFF"
            android:textColor="#FFFFFF"
            android:layout_marginTop="100dp"
            android:id="@+id/ingameBtDone"/>

    </LinearLayout>

    <LinearLayout
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:gravity="top">

        <LinearLayout
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_horizontal"
            android:layout_gravity="center_horizontal">

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:orientation="vertical"
                android:layout_weight="1.0"
                android:layout_marginRight="28dp"
                android:layout_marginLeft="26dp">

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="Score"
                    android:textColor="#FFFFFF"
                    android:shadowColor="#000000"
                    android:shadowRadius="40"
                    android:background="#000000"/>

                <ImageView
                    android:layout_height="35dp"
                    android:layout_width="35dp"
                    android:src="@android:drawable/ic_menu_myplaces"
                    android:background="#F1F137"/>

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:text="500"
                    android:textColor="#FFFFFF"
                    android:gravity="center"
                    android:id="@+id/ingameTvScore"
                    android:shadowColor="#000000"
                    android:shadowRadius="1.0"
                    android:background="#000000"/>

            </LinearLayout>

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:orientation="vertical"
                android:layout_weight="1.0"
                android:layout_marginRight="28dp"
                android:layout_marginLeft="26dp">

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:text="Stars"
                    android:gravity="center"
                    android:textColor="#FFFFFF"
                    android:shadowColor="#000000"
                    android:shadowRadius="2"
                    android:background="#000000"/>

                <ImageView
                    android:layout_height="35dp"
                    android:layout_width="35dp"
                    android:src="@android:drawable/star_on"
                    android:scaleType="fitXY"
                    android:background="#F00808"/>

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:text="5"
                    android:textColor="#FFFFFF"
                    android:gravity="center"
                    android:id="@+id/ingameTvStars"
                    android:shadowColor="#000000"
                    android:shadowRadius="2"
                    android:background="#000000"/>

            </LinearLayout>

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:orientation="vertical"
                android:layout_weight="1.0"
                android:layout_marginRight="28dp"
                android:layout_marginLeft="26dp">

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:text="Turn"
                    android:gravity="center"
                    android:textColor="#FFFFFF"
                    android:shadowColor="#000000"
                    android:shadowRadius="2"
                    android:background="#000000"/>

                <ImageView
                    android:layout_height="35dp"
                    android:layout_width="35dp"
                    android:src="@android:drawable/ic_menu_recent_history"
                    android:background="#55F80C"/>

                <TextView
                    android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:text="0"
                    android:textColor="#FFFFFF"
                    android:gravity="center"
                    android:id="@+id/ingameTvTurns"
                    android:shadowColor="#000000"
                    android:shadowRadius="2"
                    android:background="#000000"/>

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:id="@+id/ingameLLToast"/>

</FrameLayout>

Screenshots

  1. Nothing shown on the screen

    enter image description here

  2. Menu shown

    enter image description here

  3. Stat shown

    enter image description here

  4. TechTree shown

    enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.