我将泄漏金丝雀添加到我的应用程序,发现此内存泄漏:https : //i.imgur.com/8nFOoH4.png
我没有在MainActivity LinearLayout或Toast上使用,但存在此泄漏,我无法理解原因和方式。也许是因为我在MainActivity中使用的切片内使用了烤面包和线性布局?
这是我的MainActivity xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/lost_connection_image_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/fullscreen_exit"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryDark"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/userPhoto"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_margin="8dp"
android:background="@android:color/transparent"
android:src="@drawable/account_default"
android:visibility="visible"
tools:layout_editor_absoluteX="312dp"
tools:layout_editor_absoluteY="4dp"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="8dp"
app:cardBackgroundColor="@android:color/background_light"
app:cardCornerRadius="1dp"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="28dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<EditText
android:id="@+id/search_field"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@null"
android:ems="10"
android:hint="@string/search_for"
android:imeOptions="actionSearch"
android:inputType="text"
android:singleLine="true"
android:textColorHint="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/search"
app:layout_constraintStart_toStartOf=" …Run Code Online (Sandbox Code Playgroud)