android日志信息是“W / OpenGLRenderer:在View上错误地调用buildLayer”,这是什么意思?

时间:2016-11-28 08:04:27

标签: android android-layout

这是这个android片段的视图

this is the view of this android fragment

这是下面的浮动按钮部分代码:

<FrameLayout
    android:id="@+id/dialpad_floating_action_button_container"
    android:background="@drawable/fab_green"
    android:layout_width="@dimen/floating_action_button_width"
    android:layout_height="@dimen/floating_action_button_height"
    android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
    android:layout_centerHorizontal="true">

    <ImageButton
        android:id="@+id/dialpad_floating_action_button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/floating_action_button"
        android:contentDescription="@string/description_dial_button"
        android:src="@drawable/fab_ic_call"/>

</FrameLayout>

但是,Android工作室打印信息:

W/OpenGLRenderer: Incorrectly called buildLayer on View: FrameLayout, destroying layer...
W/OpenGLRenderer: Incorrectly called buildLayer on View: AppCompatImageButton, destroying layer...

并且浮动按钮不显示......

我已经尝试了很多,但仍然不知道它是如何发生的,以及如何检查原因。任何人都可以帮我吗?非常感谢!

1 个答案:

答案 0 :(得分:1)

最后,我解决了这个问题。 布局xml文件有错误,这是错误的文件内容:

<RelativeLayout
        android:layout_height="match_parent"
        android:layout_width="0dp"
        android:layout_weight="6">

        <include layout="@layout/dialpad_view"
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"
                 android:id="@+id/dialpad_floating_action_button_container"/>

        <!-- "Dialpad chooser" UI, shown only when the user brings up the
                 Dialer while a call is already in progress.
                 When this UI is visible, the other Dialer elements
                 (the textfield/button and the dialpad) are hidden. -->

        <ListView android:id="@+id/dialpadChooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_dialer_light"
                android:visibility="gone" />

        <!-- Margin bottom and alignParentBottom don't work well together, so use a Space instead. -->
        <Space android:id="@+id/dialpad_floating_action_button_margin_bottom"
            android:layout_width="match_parent"
            android:layout_height="@dimen/floating_action_button_margin_bottom"
            android:layout_alignParentBottom="true" />
        <FrameLayout
            android:id="@+id/dialpad_floating_action_button_container"
            android:background="@drawable/fab_green"
            android:layout_width="@dimen/floating_action_button_width"
            android:layout_height="@dimen/floating_action_button_height"
            android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
            android:layout_centerHorizontal="true">
            <ImageButton
                android:id="@+id/dialpad_floating_action_button"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/floating_action_button"
                android:contentDescription="@string/description_dial_button"
                android:src="@drawable/fab_ic_call"/>
        </FrameLayout>        

    </RelativeLayout>

&#34;&#34; tag有一个id,它与&#34;&#34;的id相同吼叫。我意识到也许我把这个id复制到了错误的地方。 所以,我刚删除了这个id,浮动按钮就像我预期的那样显示;

下面有正确的内容:

<RelativeLayout
        android:layout_height="match_parent"
        android:layout_width="0dp"
        android:layout_weight="6">

        <include layout="@layout/dialpad_view"
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"/>

        <!-- "Dialpad chooser" UI, shown only when the user brings up the
                 Dialer while a call is already in progress.
                 When this UI is visible, the other Dialer elements
                 (the textfield/button and the dialpad) are hidden. -->

        <ListView android:id="@+id/dialpadChooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_dialer_light"
                android:visibility="gone" />

        <!-- Margin bottom and alignParentBottom don't work well together, so use a Space instead. -->
        <Space android:id="@+id/dialpad_floating_action_button_margin_bottom"
            android:layout_width="match_parent"
            android:layout_height="@dimen/floating_action_button_margin_bottom"
            android:layout_alignParentBottom="true" />
        <FrameLayout
            android:id="@+id/dialpad_floating_action_button_container"
            android:background="@drawable/fab_green"
            android:layout_width="@dimen/floating_action_button_width"
            android:layout_height="@dimen/floating_action_button_height"
            android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
            android:layout_centerHorizontal="true">
            <ImageButton
                android:id="@+id/dialpad_floating_action_button"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/floating_action_button"
                android:contentDescription="@string/description_dial_button"
                android:src="@drawable/fab_ic_call"/>
        </FrameLayout>       

    </RelativeLayout>