Android 布局充气后分配的总成
我有很多GC_FOR_ALLOC在膨胀布局时被激发 我已经包括了Splash.java中的onCreate以及膨胀的布局 我在每一行上都使用了“Log.I”来查看GC_FOR_ALLOC在什么位置被触发,以及它在充气时发生。如果我把它评论出来,它就停止了 有没有办法阻止他们 Java类 布局文件Android 布局充气后分配的总成,android,android-layout,layout-inflater,Android,Android Layout,Layout Inflater,我有很多GC_FOR_ALLOC在膨胀布局时被激发 我已经包括了Splash.java中的onCreate以及膨胀的布局 我在每一行上都使用了“Log.I”来查看GC_FOR_ALLOC在什么位置被触发,以及它在充气时发生。如果我把它评论出来,它就停止了 有没有办法阻止他们 Java类 布局文件 static LayoutInflater inflater; public @Override void onCreate(Bundle savedInstanceState){ sup
static LayoutInflater inflater;
public @Override void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);Crashlytics.start(this);
//inflater=LayoutInflater.from(this);
inflater=(LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
View splashView=inflater.inflate(R.layout.activity_splash,null);
splashView.startAnimation(AnimationUtils.loadAnimation(this,R.anim.fade_in));
setContentView(splashView);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
android:gravity="bottom"
android:scaleType="centerCrop"
tools:ignore="ContentDescription" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom|center"
android:paddingBottom="20dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:text="@string/app_eula"
android:textAppearance="?android:attr/textAppearanceSmall" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical" >
<ImageView
android:id="@+id/splash_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:src="@drawable/ic_logo" />
<LinearLayout
android:id="@+id/error_msg"
android:layout_width="wrap_content"
android:layout_height="75dp"
android:layout_below="@id/splash_logo"
android:layout_centerHorizontal="true" >
<ImageView
android:id="@+id/error_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="@drawable/splash_error" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/error_line_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="LINE 1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="@+id/error_line_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="LINE 2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/loading_bar"
android:layout_width="wrap_content"
android:layout_height="75dp"
android:layout_below="@id/splash_logo"
android:layout_centerInParent="true" >
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>