首页 > 解决方案 > 进度条和系统动画设置关闭

问题描述

我是Android编程的初学者。我试图在我的应用程序上显示一个圆形进度条,但在 Android 7.0 手机上没有显示进度,或者在其他 Android 8.0 手机上显示一个圆形箭头不旋转。在互联网上进行了长时间的研究后,我发现这是因为在开发人员设置中禁用了动画。我不喜欢窗口动画,过渡......这个问题有什么解决方案吗?我的应用程序中的一些设置可以为进度条启用动画吗?

根据要求,我添加了一些代码。但是我的代码没有什么特别之处。我使用 Android Studio 生成了一个空应用程序。最低 SDK 21,目标 SDK 28。

我的应用程序布局:

<?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=".MainActivity">

    <ProgressBar
        android:id="@+id/Progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminate="true"/>


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

我的应用程序主要活动:

package ro.essd.testprogbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

从开发人员选项中,只有 Animator Duration Scale 会做一些事情。如果禁用,结果如下:

在此处输入图像描述

如果上述设置设置为 1x,则进度条正在旋转。

谢谢!

标签: android

解决方案


推荐阅读