在省电模式(Android 5.x)中,进度栏消失了吗? [英] Progressbar disappears in battery saver mode (Android 5.x)?

查看:122
本文介绍了在省电模式(Android 5.x)中,进度栏消失了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,在Android 5.x中启用省电模式(由用户或自动启用)后,应用程序中的ProgressBar就会消失.

没有动画,没有静态的进度条小部件-只是空的地方.

如何预防?我了解省电功能何时会禁用某些系统动画,但是进度条实际上是应用程序用户界面的重要组成部分.

以防万一-实现ProgressBar布局的代码:

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/refresh_bar"
    android:layout_alignParentTop="true"
    android:indeterminate="true"
    android:visibility="gone"
    android:layout_marginTop="@dimen/progress_bar_top_margin" />

以及如何在我的片段类中实现它:

public class FeedFragment extends Fragment {
    ...
    // Progressbar to show refreshing state
    private ProgressBar mRefreshBar;
    ...

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

            View v = inflater.inflate(R.layout.fragment_feed, container, false);    
            ...
            // Initialize and locate Refreshing progress bar
            mRefreshBar = (ProgressBar) v.findViewById(R.id.refresh_bar);
            ...
            mRefreshBar.setVisibility(View.VISIBLE);
            ...
     }
     ...
}

此外,我面临着应用程序中所有进度条的问题,而不仅仅是这个问题. 禁用省电模式时-一切正常.

解决方案

启用省电模式时,设备上的每个应用程序都会遇到相同的问题.

因为省电模式可以延长电池寿命,所以您可以使用手机,直到有机会充电为止.它发生在每个应用程序上.所以不用担心.

如何预防?

通过在设置"中禁用省电模式",然后重新启动设备.或者,您可以请求用户许可以将其禁用.

I noticed that when the Battery saver mode is enabled (by the user or automatically) in Android 5.x - ProgressBars in application just disappear.

No animation, no static progressbar widget - just empty place.

How to prevent that? I understand when Battery saver disables some system animations, but progressbars is actually an important part of the application UI.

Just in case - code that implements ProgressBar Layout:

<ProgressBar
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/refresh_bar"
    android:layout_alignParentTop="true"
    android:indeterminate="true"
    android:visibility="gone"
    android:layout_marginTop="@dimen/progress_bar_top_margin" />

And how it's implemented in my fragment class:

public class FeedFragment extends Fragment {
    ...
    // Progressbar to show refreshing state
    private ProgressBar mRefreshBar;
    ...

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

            View v = inflater.inflate(R.layout.fragment_feed, container, false);    
            ...
            // Initialize and locate Refreshing progress bar
            mRefreshBar = (ProgressBar) v.findViewById(R.id.refresh_bar);
            ...
            mRefreshBar.setVisibility(View.VISIBLE);
            ...
     }
     ...
}

Also, I facing that problem with all progress bars in application, not only with this one. When Battery saver mode disabled - all works just fine.

解决方案

When Battery saver mode is enabled, every app on the device have the same issue.

Because Battery saver mode extends the battery life so that you can use the phone until you have a chance to charge it. It happens to every application. So don't worry.

How to prevent that?

By disabling Battery saver mode in Settings and then rebooting the device. Or you can request permission from the user to disable it.

这篇关于在省电模式(Android 5.x)中,进度栏消失了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆