加强与布局80多个应用程序的意见表现 [英] Enhance app performance with more than 80 views on a layout

查看:207
本文介绍了加强与布局80多个应用程序的意见表现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个Android应用程序,其中有超过(120+意见)特定的屏幕(布局),从而产生了警告:

 的main.xml有超过80的意见,不好的表现

我有很多的 TextViews EditTexts 中,组单选按钮上组织26 TableRows

有什么我可以做,以提高应用程序的性能,并删除警告?

来源:
main.xml_capture

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / LinearLayout00
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:可聚焦=真
    机器人:focusableInTouchMode =真
    机器人:方向=垂直>    <的TableRow
        机器人:ID =@ + ID / tableRow00
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =右|顶
        机器人:重力=右>        <按钮
            机器人:ID =@ + ID / id_but_val
            机器人:layout_width =@扪/ button_width
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@绘制/ button_colored
            机器人:文字=@字符串/ but_valid
            机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>        <按钮
            机器人:ID =@ + ID / id_but_up
            机器人:layout_width =@扪/ button_width
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@绘制/ button_colored
            安卓的onClick =goToTop
            机器人:文字=@字符串/ but_ret_up
            机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>        <按钮
            机器人:ID =@ + ID / id_but_back
            机器人:layout_width =@扪/ button_width
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@绘制/ button_colored
            机器人:文字=@字符串/ but_ret_back
            机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>
    < /&的TableRow GT;    <滚动型
        机器人:ID =@ + ID / ScrollView01
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:isScrollContainer =真
        机器人:overScrollMode =总是
        机器人:scrollbarAlwaysDrawVerticalTrack =真
        机器人:scrollbarStyle =outsideInset>        <的LinearLayout
            机器人:ID =@ + ID / LinearLayout01
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:可聚焦=真
            机器人:focusableInTouchMode =真
            机器人:方向=垂直>            <的TableRow
                机器人:ID =@ + ID / TableRow01
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView01
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_84_obstacles_acces/>                < RadioGroup中
                    机器人:ID =@ + ID / RadioGroup01
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:方向=横向>                    <单选
                        机器人:ID =@ + ID / RadioButton01
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_oui/>                    <单选
                        机器人:ID =@ + ID / RadioButton02
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_non/>
                < / RadioGroup中>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow02
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView02
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_85_limit_tonnage/>                <的EditText
                    机器人:ID =@ + ID / EditText01
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:EMS =@字符串/ editTextEms
                    安卓的inputType =numberDecimal/>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow03
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top
                机器人:知名度=水涨船高>                <的TextView
                    机器人:ID =@ + ID / TextView03
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_86_derog/>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow04
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView04
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_87_limit_hauteur/>                <的EditText
                    机器人:ID =@ + ID / EditText03
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:EMS =@字符串/ editTextEms
                    安卓的inputType =numberDecimal/>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow05
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView05
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_88_limit_largeur/>                <的EditText
                    机器人:ID =@ + ID / EditText04
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:EMS =@字符串/ editTextEms
                    安卓的inputType =numberDecimal/>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow06
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView06
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_89_trav_jour/>                < RadioGroup中
                    机器人:ID =@ + ID / RadioGroup06
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:方向=横向>                    <单选
                        机器人:ID =@ + ID / RadioButton11
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_oui/>                    <单选
                        机器人:ID =@ + ID / RadioButton12
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_non/>
                < / RadioGroup中>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow07
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView07
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_90_acces_intemperies/>                < RadioGroup中
                    机器人:ID =@ + ID / RadioGroup07
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:方向=横向>                    <单选
                        机器人:ID =@ + ID / RadioButton13
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_oui/>                    <单选
                        机器人:ID =@ + ID / RadioButton14
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_non/>
                < / RadioGroup中>
            < /&的TableRow GT;            <的TableRow
                机器人:ID =@ + ID / TableRow08
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =@扪/ row_margin_top>                <的TextView
                    机器人:ID =@ + ID / TextView08
                    机器人:layout_width =@扪/ LABEL_WIDTH
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:文字=@字符串/ ecran3_91_acces_de_client/>                < RadioGroup中
                    机器人:ID =@ + ID / RadioGroup08
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginLeft =@扪/ view_left_margin
                    机器人:方向=横向>                    <单选
                        机器人:ID =@ + ID / RadioButton15
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_oui/>                    <单选
                        机器人:ID =@ + ID / RadioButton16
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文字=@字符串/ radio_value_non/>
                < / RadioGroup中>
            < /&的TableRow GT;            <的LinearLayout
                机器人:ID =@ + ID / LinearLayout02
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:方向=垂直>                <的TableRow
                    机器人:ID =@ + ID / TableRow09
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginTop =@扪/ row_margin_top>                    <的TextView
                        机器人:ID =@ + ID / TextView09
                        机器人:layout_width =@扪/ LABEL_WIDTH
                        机器人:layout_height =FILL_PARENT
                        机器人:layout_marginLeft =@扪/ view_left_margin
                        机器人:文字=@字符串/ ecran3_92_contraintes_reservoir/>                    <的EditText
                        机器人:ID =@ + ID / EditText05
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:layout_marginLeft =@扪/ view_left_margin
                        机器人:EMS =@字符串/ editTextEms
                        安卓的inputType =TEXT/>
                < /&的TableRow GT;                <的TableRow
                    机器人:ID =@ + ID / TableRow10
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginTop =@扪/ row_margin_top>                    <的TextView
                        机器人:ID =@ + ID / TextView10
                        机器人:layout_width =@扪/ LABEL_WIDTH
                        机器人:layout_height =FILL_PARENT
                        机器人:layout_marginLeft =@扪/ view_left_margin
                        机器人:文字=@字符串/ ecran3_93_dalle_ preT/>                    < RadioGroup中
                        机器人:ID =@ + ID / RadioGroup10
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:layout_marginLeft =@扪/ view_left_margin
                        机器人:方向=横向>                        <单选
                            机器人:ID =@ + ID / RadioButton19
                            机器人:layout_width =WRAP_CONTENT
                            机器人:layout_height =WRAP_CONTENT
                            机器人:文字=@字符串/ radio_value_oui/>                        <单选
                            机器人:ID =@ + ID / RadioButton20
                            机器人:layout_width =WRAP_CONTENT
                            机器人:layout_height =WRAP_CONTENT
                            机器人:文字=@字符串/ radio_value_non/>
                    < / RadioGroup中>
                < /&的TableRow GT;
&所述;! - TableRow10到TableRow26 - >
            < / LinearLayout中>
        < / LinearLayout中>
    < /滚动型>< / LinearLayout中>


解决方案

在没有看到你的完整布局,我会说,以取代 TableLayout 的ListView
我猜测,你有多个的每一行,如果你切换到的ListView 你会避免了需要加载在内存中的整个布局,而不是你的屏幕上只载入可见行的的ListView +任何意见,你有除此之外

通过上面的方法,你就可以从当前布局中删除行相当数量的。

编辑:

根据您的附加布局,一些建议:


  • 的TableRow 可作为布局中一个正常的观点,但其主要目的是成为一个孩子 TableLayout

  • 如果您不希望您的按钮做 tableRow00 有相同的宽度,那么你可以做一个小的改进并且,代替目前的布局,取代 LinearLayout00 RelativeLayout的,删除 tableRow00 ,然后将按钮使用 RelativeLayout的规则滚动型

  • 替换 LinearLayout01 TableLayout

  • 我不知道你为什么加入 LinearLayout02 (我猜所有的行都是一样的?!),但你应该将其删除,直接追加 TableRow09 - TableRow26 LinearLayout01

  • 我的回答的其余部分保持。

I'm creating an android application, which has a particular screen (layout) with over (120+ views), which generates the warning:

   "main.xml has more than 80 views, bad for performance"

I have lots of TextViews, EditTexts, groups of RadioButtons organized on 26 TableRows.

Is there anything I can do to enhance application performance and remove warning?

source: main.xml_capture

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout00"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:orientation="vertical" >

    <TableRow
        android:id="@+id/tableRow00"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="right|top"
        android:gravity="right" >

        <Button
            android:id="@+id/id_but_val"
            android:layout_width="@dimen/button_width"
            android:layout_height="wrap_content"
            android:background="@drawable/button_colored"
            android:text="@string/but_valid"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <Button
            android:id="@+id/id_but_up"
            android:layout_width="@dimen/button_width"
            android:layout_height="wrap_content"
            android:background="@drawable/button_colored"
            android:onClick="goToTop"
            android:text="@string/but_ret_up"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <Button
            android:id="@+id/id_but_back"
            android:layout_width="@dimen/button_width"
            android:layout_height="wrap_content"
            android:background="@drawable/button_colored"
            android:text="@string/but_ret_back"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </TableRow>

    <ScrollView
        android:id="@+id/ScrollView01"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:isScrollContainer="true"
        android:overScrollMode="always"
        android:scrollbarAlwaysDrawVerticalTrack="true"
        android:scrollbarStyle="outsideInset" >

        <LinearLayout
            android:id="@+id/LinearLayout01"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:orientation="vertical" >

            <TableRow
                android:id="@+id/TableRow01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView01"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_84_obstacles_acces" />

                <RadioGroup
                    android:id="@+id/RadioGroup01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:orientation="horizontal" >

                    <RadioButton
                        android:id="@+id/RadioButton01"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_oui" />

                    <RadioButton
                        android:id="@+id/RadioButton02"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_non" />
                </RadioGroup>
            </TableRow>

            <TableRow
                android:id="@+id/TableRow02"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView02"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_85_limit_tonnage" />

                <EditText
                    android:id="@+id/EditText01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:ems="@string/editTextEms"
                    android:inputType="numberDecimal" />
            </TableRow>

            <TableRow
                android:id="@+id/TableRow03"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top"
                android:visibility="gone" >

                <TextView
                    android:id="@+id/TextView03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_86_derog" />
            </TableRow>

            <TableRow
                android:id="@+id/TableRow04"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView04"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_87_limit_hauteur" />

                <EditText
                    android:id="@+id/EditText03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:ems="@string/editTextEms"
                    android:inputType="numberDecimal" />
            </TableRow>

            <TableRow
                android:id="@+id/TableRow05"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView05"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_88_limit_largeur" />

                <EditText
                    android:id="@+id/EditText04"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:ems="@string/editTextEms"
                    android:inputType="numberDecimal" />
            </TableRow>

            <TableRow
                android:id="@+id/TableRow06"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView06"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_89_trav_jour" />

                <RadioGroup
                    android:id="@+id/RadioGroup06"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:orientation="horizontal" >

                    <RadioButton
                        android:id="@+id/RadioButton11"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_oui" />

                    <RadioButton
                        android:id="@+id/RadioButton12"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_non" />
                </RadioGroup>
            </TableRow>

            <TableRow
                android:id="@+id/TableRow07"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView07"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_90_acces_intemperies" />

                <RadioGroup
                    android:id="@+id/RadioGroup07"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:orientation="horizontal" >

                    <RadioButton
                        android:id="@+id/RadioButton13"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_oui" />

                    <RadioButton
                        android:id="@+id/RadioButton14"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_non" />
                </RadioGroup>
            </TableRow>

            <TableRow
                android:id="@+id/TableRow08"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/row_margin_top" >

                <TextView
                    android:id="@+id/TextView08"
                    android:layout_width="@dimen/label_width"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:text="@string/ecran3_91_acces_de_client" />

                <RadioGroup
                    android:id="@+id/RadioGroup08"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/view_left_margin"
                    android:orientation="horizontal" >

                    <RadioButton
                        android:id="@+id/RadioButton15"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_oui" />

                    <RadioButton
                        android:id="@+id/RadioButton16"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/radio_value_non" />
                </RadioGroup>
            </TableRow>

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

                <TableRow
                    android:id="@+id/TableRow09"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/row_margin_top" >

                    <TextView
                        android:id="@+id/TextView09"
                        android:layout_width="@dimen/label_width"
                        android:layout_height="fill_parent"
                        android:layout_marginLeft="@dimen/view_left_margin"
                        android:text="@string/ecran3_92_contraintes_reservoir" />

                    <EditText
                        android:id="@+id/EditText05"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/view_left_margin"
                        android:ems="@string/editTextEms"
                        android:inputType="text" />
                </TableRow>

                <TableRow
                    android:id="@+id/TableRow10"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/row_margin_top" >

                    <TextView
                        android:id="@+id/TextView10"
                        android:layout_width="@dimen/label_width"
                        android:layout_height="fill_parent"
                        android:layout_marginLeft="@dimen/view_left_margin"
                        android:text="@string/ecran3_93_dalle_pret" />

                    <RadioGroup
                        android:id="@+id/RadioGroup10"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/view_left_margin"
                        android:orientation="horizontal" >

                        <RadioButton
                            android:id="@+id/RadioButton19"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/radio_value_oui" />

                        <RadioButton
                            android:id="@+id/RadioButton20"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/radio_value_non" />
                    </RadioGroup>
                </TableRow>
<!-- TableRow10 to TableRow26 -->
            </LinearLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>

解决方案

Without seeing your full layout I would say to replace that TableLayout with a ListView. I'm guessing that you have a number of Views for each row, if you switch to a ListView you'll avoid the need to load the entire layout in memory, instead you'll load only the visible rows on the screen of the ListView + any views you have besides that.

With the above approach, you'll be able to remove a substantial number of rows from the current layout.

EDIT :

Based on your added layout, some advices:

  • TableRow can be used as a normal view in a layout but its main purpose it to be a child of a TableLayout.
  • If you don't want your Buttons from tableRow00 to have equal width then you can make a small improvement and instead of your current layout, replace LinearLayout00 with a RelativeLayout, remove the tableRow00 and then place the Buttons and the ScrollView using the rules of RelativeLayout.
  • Replace LinearLayout01 with a TableLayout.
  • I don't know why you added the LinearLayout02(I'm guessing all of your rows are the same?!) but you should remove it and directly append TableRow09 - TableRow26 to LinearLayout01.
  • The rest of my answer remains.

这篇关于加强与布局80多个应用程序的意见表现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆