简体   繁体   中英

Fragment display issue in tablet container android

I am working on a tablet with android version 7.0, I'm having a display issue while clicking on the listview cell of the first fragment (on the left side) to display the information details on the second fragment (on the right side). It takes at least 5 seconds to display. There are many views that are gone. I have been stuck for the last couple of days and I couldn't fix it.

在此处输入图片说明

<ScrollView
    android:id="@+id/scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include
            android:id="@+id/section1"
            layout="@layout/layout_section1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp" />

        <include
            android:id="@+id/section2"
            layout="@layout/layout_section2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout_section1"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp" />

        <include
            android:id="@+id/section3"
            layout="@layout/layout_section3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout_section2"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp" />

        <LinearLayout
            android:id="@+id/layout_buttons"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/section3"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="10dp"
            android:weightSum="3">

            <Button
                android:id="@+id/button1"
                android:layout_width="0dp"
                android:layout_height="35dp"
                android:layout_marginRight="5dp"
                android:layout_weight="1"
                android:background="@color/section"
                android:drawableLeft="@drawable/icon_guide"
                android:text="@string/guide"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:textColor="@color/white_color"
                android:textSize="14sp" />

            <Button
                android:id="@+id/button2"
                android:layout_width="0dp"
                android:layout_height="35dp"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:layout_weight="1"
                android:background="@color/section"
                android:drawableLeft="@drawable/icon_modif"
                android:text="@string/modifier"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:textColor="@color/white_color"
                android:textSize="14sp" />

            <Button
                android:id="@+id/button3"
                android:layout_width="0dp"
                android:layout_height="35dp"
                android:layout_marginLeft="5dp"
                android:layout_weight="1"
                android:background="@color/section"
                android:drawableLeft="@drawable/icon_delete"
                android:text="@string/supprimer"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:textColor="@color/white_color"
                android:textSize="14sp" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/layout_edit_validate_cancel_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/section3"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:gravity="center"
            android:visibility="gone"
            android:weightSum="2"
            android:orientation="vertical">

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

                <Button
                    android:id="@+id/validate_button"
                    android:layout_width="78dp"
                    android:layout_height="35dp"
                    android:layout_gravity="center"
                    android:layout_marginRight="20dp"
                    android:background="@drawable/register_button_bg"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:text="@string/validate_button"
                    android:textColor="@color/white_color"
                    android:textSize="14sp" />

                <Button
                    android:id="@+id/cancel_button"
                    android:layout_width="78dp"
                    android:layout_height="35dp"
                    android:layout_gravity="center"
                    android:background="@drawable/register_button_bg"
                    android:paddingLeft="10dp"
                    android:paddingRight="10dp"
                    android:text="@string/cancel_button"
                    android:textColor="@color/white_color"
                    android:textSize="14sp" />

            </LinearLayout>


            <View
                android:id="@+id/separator"
                android:layout_width="match_parent"
                android:layout_height="0.7dp"
                android:layout_gravity="center_horizontal"
                android:background="@color/light_grey"
                android:layout_marginTop="20dp"/>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/layout_pwd_validate_update"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/section3"
            android:layout_marginLeft="35dp"
            android:orientation="vertical"
            android:paddingBottom="30dp"
            android:visibility="gone">

            <com.example.ui.RobotoTextView
                android:id="@+id/validation_message"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="10dp"
                android:background="@android:color/white"
                android:maxWidth="300dp"
                android:text="@string/validation_message"
                android:textSize="16dp" />


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginBottom="20dp"
                android:layout_marginRight="40dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/background_border"
                android:orientation="vertical">


                <EditText
                    android:id="@+id/password_edit"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@android:color/transparent"
                    android:gravity="right|center"
                    android:inputType="numberPassword"
                    android:maxLength="6"
                    android:paddingRight="10dp"
                    android:textColor="@color/black_color" />

            </LinearLayout>


            <Button
                android:id="@+id/validate_button"
                android:layout_width="78dp"
                android:layout_height="35dp"
                android:layout_gravity="center"
                android:layout_marginBottom="40dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/register_button_bg"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:text="@string/validate_button"
                android:textColor="@color/white_color"
                android:textSize="14dp"
                android:visibility="gone"/>

        </LinearLayout>



        <RelativeLayout
            android:id="@+id/progress_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/transparent_grey"
            android:visibility="gone">

            <ProgressBar
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_centerInParent="true" />

        </RelativeLayout>
    </RelativeLayout>
</ScrollView>

<com.example.ui.KeyboardViewNumber
    android:id="@+id/keyboard_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/keyboard_color"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:gravity="bottom"
    android:keyBackground="@drawable/push_keyboard_btn"
    android:keyTextColor="#000000"
    android:keyTextSize="25dp"
    android:paddingTop="1dp"
    android:shadowColor="#FFFFFF"
    android:shadowRadius="0.0"
    android:visibility="visible" />

i found the solution, and the best way to resolve my problem is to use only Relative Layouts. The Linear Layouts caused me lots of problems when rendring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM