In my Android apps, 30% of my users experience slow rendering. My application has a rather complicated interface, so I did a really basic project to try and solve this problem. But this turns out to be pretty slow even with the simplest layouts.
A layout is centered text that Android Studio offers as a template:
<?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"
tools:context="slowrenderingtest.pichaipls.com.slowrenderingtest.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/timerView"
android:text="00:00"
android:textSize="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
Activity using the layout changes the text every second (because it's a timer):
Timer updateTicks = new Timer();
updateTicks.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Random r = new Random();
timerView.setText(String.format("%02d", r.nextInt(60))+":"+
String.format("%02d", r.nextInt(60)));
}
});
}
}, 100, 1000);
GPU, 16 (-, 30% ). TextView. : , , . ( ), . , , CPU/GPU ( ).
- Android. ( , - 5% , , ), , . , , Android .
- ?