samedi 18 juin 2016

Android Main thread too much work

I'm building my first app, but after adding a few layout stuff a DrawerLayout to be exact it started to give me an error:

I/Choreographer: Skipped 126 frames! The application may be doing too much work on its main thread

This here is my layout code:

<!-- The main content view -->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">




<!-- ładowanie toolbara -->
<include
 layout="@layout/tool_bar"

/>
<include
layout="@layout/twoja_strona"

/>
<RelativeLayout


    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:layout="http://schemas.android.com/apk/res-auto"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="pl.webimpuls.wicms.MainActivity"
    android:background="#e7e7e7">




<GridLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:columnCount="2"
    android:rowCount="4"
    android:id="@+id/gridLayout">

        <RelativeLayout android:layout_width="fill_parent"
            android:orientation="horizontal">
        <RelativeLayout
        android:layout_width="160dp"
        android:layout_height="100dp"
        android:layout_row="1"
        android:layout_column="1"
            android:background="@color/background_material_light"
            android:layout_marginRight="5dp"
            android:layout_gravity="center|left"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="0dp"
            android:layout_alignParentTop="true"
            android:layout_marginTop="0dp"
            android:id="@+id/dodaj_wpis"
            android:clickable="true"
            android:onClick="dodajaaktualnosc">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView2"
                android:src="@mipmap/dodaj_wpis"
                android:layout_above="@+id/textView"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                      android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Dodaj Wpis"
                android:id="@+id/textView"
                android:textAlignment="center"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="160dp"
            android:layout_height="100dp"
            android:layout_row="1"
            android:layout_column="0"
            android:background="@color/background_material_light"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:id="@+id/lista_aktualnosci"
            android:clickable="true"
            android:onClick="czytajaktualnosc">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView3"
                android:src="@mipmap/lista_aktualnosci"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_alignParentTop="true"
                android:layout_above="@+id/textView2"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Lista Aktualności"
                android:id="@+id/textView2"
                android:textAlignment="center"
                android:singleLine="true"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true" />
        </RelativeLayout>

        </RelativeLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_row="2"
            android:layout_column="0"
            android:layout_marginBottom="10dp"
            android:background="@color/background_material_light"
            android:layout_marginTop="10dp"
            android:id="@+id/twoje_leady"
            android:clickable="true"
            android:onClick="leady">

            <ImageView
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageView4"
                android:src="@mipmap/twoje_leady"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_marginLeft="30dp"
                android:layout_alignParentBottom="true" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Twoje Leady"
                android:id="@+id/textView3"
                android:textAlignment="center"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/imageView4"
                android:layout_toEndOf="@+id/imageView4"
                android:layout_marginLeft="46dp"
                android:layout_marginStart="46dp" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_row="3"
            android:layout_column="0"
            android:background="@color/background_material_light"
            android:id="@+id/otworz_strone"
            android:clickable="true"
            android:onClick="otworzstrone">

            <ImageView
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:id="@+id/imageView5"
                android:src="@mipmap/otworz_strone"
                android:layout_alignParentTop="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_marginLeft="30dp"
                android:layout_alignParentBottom="true" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Otwórz Stronę"
                android:id="@+id/textView4"
                android:textAlignment="center"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/imageView5"
                android:layout_toEndOf="@+id/imageView5"
                android:layout_marginLeft="46dp"
                android:layout_marginStart="46dp" />

        </RelativeLayout>

    </GridLayout>
<include
    layout="@layout/stopka"
    android:layout_alignParentBottom="true"
    android:layout_height="50dp"
    android:layout_width="wrap_content">

</include>
</RelativeLayout>

</LinearLayout>

<include
layout="@layout/menu_wysuwajace"></include>

</android.support.v4.widget.DrawerLayout>

Please I need to knwo what's going on.

Aucun commentaire:

Enregistrer un commentaire