我有一个跳帧的问题,在一个真正的设备上,大约90-110帧,但在模拟器上它只有20-30。 我有这个问题,因为我有一个活动内的5个片段,每个片段都有15到30个按钮,它们是LinearLayouts,因为我需要在一个按钮中放置两个图片和TextView,这似乎是一种方法。Android - 用加载动画替换跳过的框架
这就是它跳过帧的原因,我需要等待几秒钟才能打开活动。
这看起来不太好,因为碎片中的数据量不足,我决定创建加载动画。
但问题是,无论何时创建它,遵循YouTube或StackOverflow上的各种教程,只有在活动打开时才会出现加载动画,然后就没有用处。
有谁知道解决方案?
活动XML
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context="hr.app.liftme.liftmehr.Vjezbe">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:elevation="0dp"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.AppBarOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_vjezbe" />
</android.support.design.widget.CoordinatorLayout>
内容的XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:elevation="0dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="hr.app.liftme.liftmehr.Vjezbe"
tools:showIn="@layout/activity_vjezbe"
android:id="@+id/loadingPanel">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="Vježbe"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
app:tabMode="scrollable"
app:tabGravity="fill"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/viewPager"
android:background="#ffffff">
</android.support.v4.view.ViewPager>
</android.support.design.widget.AppBarLayout>
</LinearLayout>
这并没有解决我的问题,但无论如何感谢 – DaxHR