setVisibility(View.GONE)是否会暂停绘图?

时间:2016-10-28 00:01:02

标签: java android

我对android很新,并注意到一些非常奇怪的东西(如果我的理论不正确),我有这种布局:

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipeContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</android.support.v4.widget.SwipeRefreshLayout>

我注意到一种让我思考的行为,当你打电话给setVisibility(View.GONE)它暂停视图的绘制(动画)时,这是行动的过程:

swipeContainer.setVisibility(View.VISIBLE); // Show container
swipeContainer.setRefreshing(true); // Loader is shown
//->And now few seconds it the future after data loaded...`
swipeContainer.setRefreshing(false); // Loader dismiss animation starts..., spinner diameter starts to get smaller(the dismiss animation) but pauses with a very small diameter.
swipeContainer.setVisibility(View.GONE); // Here is where I think the drawing pauses.
//-> Few seconds later...
swipeContainer.setVisibility(View.VISIBLE); // The very small diameter spinner is shown and continue to get smaller until the animation ends.

我对所看到的内容没有其他解释,我花了很多时间来思考它,基本上我要知道的是:在调用{{1}时,android是否会暂停视图绘制}?

更新

感谢@Nordenheim我还检查了setVisibility(View.GONE),但仍然是相同的行为,所以我检查了swipeContainer.setVisibility(View.INVISIBLE);,现在问题已经消失了,但问题仍然存在swipeContainer.setAlpha(0f);,我只想要确认/拒绝。

0 个答案:

没有答案